Replace deprecated symbol usage in whole project: enable on annotation declared without parentheses #KT-12479 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fa51354ef9
commit
8089d2e9e3
+1
@@ -58,6 +58,7 @@ class DeprecatedSymbolUsageInWholeProjectFix(
|
|||||||
is KtProperty -> referenceTarget
|
is KtProperty -> referenceTarget
|
||||||
is KtTypeAlias -> referenceTarget
|
is KtTypeAlias -> referenceTarget
|
||||||
is KtConstructor<*> -> referenceTarget.getContainingClassOrObject() //TODO: constructor can be deprecated itself
|
is KtConstructor<*> -> referenceTarget.getContainingClassOrObject() //TODO: constructor can be deprecated itself
|
||||||
|
is KtClass -> referenceTarget.takeIf { it.isAnnotation() }
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package dependency
|
||||||
|
|
||||||
|
@Deprecated("", ReplaceWith("dependency.NewAnnotation"))
|
||||||
|
annotation class OldAnnotation
|
||||||
|
|
||||||
|
annotation class NewAnnotation()
|
||||||
|
|
||||||
|
@NewAnnotation
|
||||||
|
class C
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// "Replace with 'test.Bar'" "true"
|
||||||
|
|
||||||
|
package x
|
||||||
|
|
||||||
|
import dependency.*
|
||||||
|
|
||||||
|
annotation class A(val a: NewAnnotation)
|
||||||
|
|
||||||
|
@A(NewAnnotation()) class Y
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// "Replace usages of 'OldAnnotation' in whole project" "true"
|
||||||
|
|
||||||
|
package test
|
||||||
|
|
||||||
|
import dependency.NewAnnotation
|
||||||
|
|
||||||
|
fun foo(a: NewAnnotation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@<caret>NewAnnotation
|
||||||
|
class X
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package dependency
|
||||||
|
|
||||||
|
@Deprecated("", ReplaceWith("dependency.NewAnnotation"))
|
||||||
|
annotation class OldAnnotation
|
||||||
|
|
||||||
|
annotation class NewAnnotation()
|
||||||
|
|
||||||
|
@OldAnnotation
|
||||||
|
class C
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// "Replace usages of 'OldAnnotation' in whole project" "true"
|
||||||
|
|
||||||
|
package test
|
||||||
|
|
||||||
|
import dependency.OldAnnotation
|
||||||
|
|
||||||
|
fun foo(a: OldAnnotation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@<caret>OldAnnotation
|
||||||
|
class X
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// "Replace with 'test.Bar'" "true"
|
||||||
|
|
||||||
|
package x
|
||||||
|
|
||||||
|
import dependency.*
|
||||||
|
|
||||||
|
annotation class A(val a: OldAnnotation)
|
||||||
|
|
||||||
|
@A(OldAnnotation()) class Y
|
||||||
+5
@@ -2395,6 +2395,11 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
|||||||
public void testAnnotation() throws Exception {
|
public void testAnnotation() throws Exception {
|
||||||
runTest("idea/testData/quickfix/deprecatedSymbolUsage/classUsages/wholeProject/annotation.before.Main.kt");
|
runTest("idea/testData/quickfix/deprecatedSymbolUsage/classUsages/wholeProject/annotation.before.Main.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noParenthesesAnnotation.before.Main.kt")
|
||||||
|
public void testNoParenthesesAnnotation() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/deprecatedSymbolUsage/classUsages/wholeProject/noParenthesesAnnotation.before.Main.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user