Add quickfix for migrating Java annotation method calls
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace method call with property access" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(ann: Ann) {
|
||||
ann.value
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Replace method call with property access" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(ann: Ann) {
|
||||
ann.value()<caret>
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public @interface Ann {
|
||||
int value();
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// "Replace deprecated method calls with property access in current file" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
fun bar(x: Int) {
|
||||
javaClass<A>().getAnnotation(javaClass<Ann>()).args[0]
|
||||
javaClass<A>().getAnnotation(javaClass<Ann>()).y
|
||||
}
|
||||
|
||||
fun foo(ann: Ann, a: A) {
|
||||
ann.value
|
||||
bar(ann.x + (ann).y)
|
||||
|
||||
a.foo()
|
||||
|
||||
a.equals(a)
|
||||
a.toString()
|
||||
a.hashCode()
|
||||
|
||||
class Local {
|
||||
val prop = ann.arg
|
||||
fun baz() {
|
||||
val v = ann.args
|
||||
val summ = ann.x * ann.ext()
|
||||
}
|
||||
|
||||
fun Ann.ext(): Int = -y
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// "Replace deprecated method calls with property access in current file" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
fun bar(x: Int) {
|
||||
javaClass<A>().getAnnotation(javaClass<Ann>()).args()[0]
|
||||
javaClass<A>().getAnnotation(javaClass<Ann>()).y()
|
||||
}
|
||||
|
||||
fun foo(ann: Ann, a: A) {
|
||||
ann.value()<caret>
|
||||
bar(ann.x() + (ann).y())
|
||||
|
||||
a.foo()
|
||||
|
||||
a.equals(a)
|
||||
a.toString()
|
||||
a.hashCode()
|
||||
|
||||
class Local {
|
||||
val prop = ann.arg()
|
||||
fun baz() {
|
||||
val v = ann.args()
|
||||
val summ = ann.x() * ann.ext()
|
||||
}
|
||||
|
||||
fun Ann.ext(): Int = -y()
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public @interface Ann {
|
||||
Class<?> value();
|
||||
int x() default 1;
|
||||
int y() default 2;
|
||||
Class<?> arg() default String;
|
||||
Class<?>[] args() default {};
|
||||
}
|
||||
Reference in New Issue
Block a user