Remove AddStarProjectionsFix for removed javaClass<T> function.
This commit is contained in:
@@ -48,29 +48,4 @@ open class AddStarProjectionsFix private constructor(element: KtUserType,
|
||||
return AddStarProjectionsFix(unwrappedType, diagnosticWithParameters.a)
|
||||
}
|
||||
}
|
||||
|
||||
object JavaClassFactory : KotlinSingleIntentionActionFactory() {
|
||||
public override fun createAction(diagnostic: Diagnostic): IntentionAction? {
|
||||
val diagnosticWithParameters = Errors.WRONG_NUMBER_OF_TYPE_ARGUMENTS.cast(diagnostic)
|
||||
val size = diagnosticWithParameters.a
|
||||
val userType = QuickFixUtil.getParentElementOfType(diagnostic, KtUserType::class.java) ?: return null
|
||||
return object : AddStarProjectionsFix(userType, size) {
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||
// We are looking for the occurrence of Type in javaClass<Type>()
|
||||
return super.isAvailable(project, editor, file) && isZeroTypeArguments && isInsideJavaClassCall
|
||||
}
|
||||
|
||||
private val isZeroTypeArguments: Boolean
|
||||
get() = element.typeArguments.isEmpty()
|
||||
|
||||
// Resolve is expensive so we use a heuristic here: the case is rare enough not to be annoying
|
||||
private val isInsideJavaClassCall: Boolean
|
||||
get() {
|
||||
val call = element.parent.parent.parent.parent as? KtCallExpression
|
||||
val callee = call?.calleeExpression as? KtSimpleNameExpression
|
||||
return callee?.getReferencedName() == "javaClass"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,6 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
BREAK_OR_CONTINUE_IN_WHEN.registerFactory(AddLoopLabelFix)
|
||||
|
||||
NO_TYPE_ARGUMENTS_ON_RHS.registerFactory(AddStarProjectionsFix.IsExpressionFactory)
|
||||
WRONG_NUMBER_OF_TYPE_ARGUMENTS.registerFactory(AddStarProjectionsFix.JavaClassFactory)
|
||||
|
||||
TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER.registerFactory(RemovePsiElementSimpleFix.RemoveTypeArgumentsFactory)
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddStarProjectionsFix" "false"
|
||||
// ERROR: Type argument expected
|
||||
class C2<T>
|
||||
|
||||
fun <T> foo() {}
|
||||
|
||||
fun test() {
|
||||
foo<C2<caret>>()
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddStarProjectionsFix" "false"
|
||||
// ERROR: Type argument expected
|
||||
class C2<T>
|
||||
|
||||
fun <T> foo() {}
|
||||
|
||||
fun test() {
|
||||
foo<C2<caret>>()
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// "Add '<*>'" "true"
|
||||
class C1<T>
|
||||
|
||||
fun test() {
|
||||
javaClass<C1<caret>>()
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Add '<*>'" "true"
|
||||
class C1<T>
|
||||
|
||||
fun test() {
|
||||
javaClass<C1<*>>()
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// "Add '<*, *>'" "true"
|
||||
class C2<T, R>
|
||||
|
||||
fun test() {
|
||||
javaClass<C2<caret>>()
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Add '<*, *>'" "true"
|
||||
class C2<T, R>
|
||||
|
||||
fun test() {
|
||||
javaClass<C2<*, *>>()
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddStarProjectionsFix" "false"
|
||||
class C
|
||||
|
||||
fun test() {
|
||||
javaClass<C<caret>>()
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddStarProjectionsFix" "false"
|
||||
class C
|
||||
|
||||
fun test() {
|
||||
javaClass<C<caret>>
|
||||
}
|
||||
@@ -442,39 +442,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/addStarProjections/javaClass")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JavaClass extends AbstractQuickFixTest {
|
||||
public void testAllFilesPresentInJavaClass() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/addStarProjections/javaClass"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("fooOfC2.kt")
|
||||
public void testFooOfC2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addStarProjections/javaClass/fooOfC2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaClassOfC1Runtime.kt")
|
||||
public void testJavaClassOfC1Runtime() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addStarProjections/javaClass/javaClassOfC1Runtime.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaClassOfC2Runtime.kt")
|
||||
public void testJavaClassOfC2Runtime() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addStarProjections/javaClass/javaClassOfC2Runtime.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaClassOfCRuntime.kt")
|
||||
public void testJavaClassOfCRuntime() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/addStarProjections/javaClass/javaClassOfCRuntime.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/addStarProjections/when")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user