Quick fix renamed: ChangePrivateTopLevelToInternal --> IncreaseVisibility
This commit is contained in:
+3
-2
@@ -30,7 +30,8 @@ import org.jetbrains.kotlin.psi.KtModifierListOwner
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
|
||||
class ChangePrivateTopLevelToInternalFix(element: KtModifierListOwner, private val elementName: String) : KotlinQuickFixAction<KtModifierListOwner>(element), CleanupFix {
|
||||
class IncreaseVisibilityFix(element: KtModifierListOwner, private val elementName: String) :
|
||||
KotlinQuickFixAction<KtModifierListOwner>(element), CleanupFix {
|
||||
override fun getText() = "Make $elementName internal"
|
||||
override fun getFamilyName() = "Make top-level declaration internal"
|
||||
|
||||
@@ -48,7 +49,7 @@ class ChangePrivateTopLevelToInternalFix(element: KtModifierListOwner, private v
|
||||
descriptor.visibility != Visibilities.PRIVATE) return null
|
||||
|
||||
val declaration = DescriptorToSourceUtils.getSourceFromDescriptor(descriptor) as? KtModifierListOwner ?: return null
|
||||
return ChangePrivateTopLevelToInternalFix(declaration, descriptor.name.asString())
|
||||
return IncreaseVisibilityFix(declaration, descriptor.name.asString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,9 +149,9 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
CANNOT_CHANGE_ACCESS_PRIVILEGE.registerFactory(ChangeVisibilityModifierFix)
|
||||
CANNOT_WEAKEN_ACCESS_PRIVILEGE.registerFactory(ChangeVisibilityModifierFix)
|
||||
|
||||
INVISIBLE_REFERENCE.registerFactory(ChangePrivateTopLevelToInternalFix)
|
||||
INVISIBLE_MEMBER.registerFactory(ChangePrivateTopLevelToInternalFix)
|
||||
INVISIBLE_SETTER.registerFactory(ChangePrivateTopLevelToInternalFix)
|
||||
INVISIBLE_REFERENCE.registerFactory(IncreaseVisibilityFix)
|
||||
INVISIBLE_MEMBER.registerFactory(IncreaseVisibilityFix)
|
||||
INVISIBLE_SETTER.registerFactory(IncreaseVisibilityFix)
|
||||
|
||||
REDUNDANT_NULLABLE.registerFactory(RemoveNullableFix.Factory(RemoveNullableFix.NullableKind.REDUNDANT))
|
||||
NULLABLE_SUPERTYPE.registerFactory(RemoveNullableFix.Factory(RemoveNullableFix.NullableKind.SUPERTYPE))
|
||||
|
||||
@@ -1286,6 +1286,39 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/increaseVisibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class IncreaseVisibility extends AbstractQuickFixMultiFileTest {
|
||||
public void testAllFilesPresentInIncreaseVisibility() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/increaseVisibility"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelFunInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelFunInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/increaseVisibility/privateTopLevelFunInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelValInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelValInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/increaseVisibility/privateTopLevelValInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelVarInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelVarInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/increaseVisibility/privateTopLevelVarInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelVarWithSetterInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelVarWithSetterInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/increaseVisibility/privateTopLevelVarWithSetterInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/migration")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1458,39 +1491,6 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/privateInFiles")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PrivateInFiles extends AbstractQuickFixMultiFileTest {
|
||||
public void testAllFilesPresentInPrivateInFiles() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/privateInFiles"), Pattern.compile("^(\\w+)\\.((before\\.Main\\.\\w+)|(test))$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelFunInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelFunInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/privateInFiles/privateTopLevelFunInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelValInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelValInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/privateInFiles/privateTopLevelValInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelVarInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelVarInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/privateInFiles/privateTopLevelVarInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateTopLevelVarWithSetterInFile.before.Main.kt")
|
||||
public void testPrivateTopLevelVarWithSetterInFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/privateInFiles/privateTopLevelVarWithSetterInFile.before.Main.kt");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user