Add quick fix to add required target to annotation #KT-20484 Fixed

This commit is contained in:
Toshiaki Kameyama
2017-10-06 13:14:47 +03:00
committed by Mikhail Glukhikh
parent 204d9e3423
commit 9ea9ea1008
18 changed files with 295 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
annotation class Foo
class Test {
fun foo(): <caret>@Foo Int = 1
}
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.TYPE) annotation class Foo
class Test {
fun foo(): @Foo Int = 1
}
+7
View File
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target
annotation class Foo
<caret>@Foo
class Test
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS)
annotation class Foo
@Foo
class Test
+7
View File
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target()
annotation class Foo
<caret>@Foo
class Test
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS)
annotation class Foo
@Foo
class Test
+9
View File
@@ -0,0 +1,9 @@
// "Add annotation target" "true"
annotation class Foo
@Foo
class Test {
@Foo
fun foo(): <caret>@Foo Int = 1
}
@@ -0,0 +1,9 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) annotation class Foo
@Foo
class Test {
@Foo
fun foo(): @Foo Int = 1
}
+9
View File
@@ -0,0 +1,9 @@
// "Add annotation target" "false"
// WITH_RUNTIME
// ACTION: Make internal
// ACTION: Make private
// ACTION: Specify type explicitly
// ERROR: This annotation is not applicable to target 'top level property without backing field or delegate'
<caret>@JvmField
val x get() = 42
@@ -0,0 +1,8 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class Foo
class Test {
fun foo(): <caret>@Foo Int = 1
}
@@ -0,0 +1,8 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
annotation class Foo
class Test {
fun foo(): @Foo Int = 1
}
@@ -0,0 +1,10 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class Foo
@Foo
class Test {
@Foo
fun foo(): <caret>@Foo Int = 1
}
@@ -0,0 +1,10 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE)
annotation class Foo
@Foo
class Test {
@Foo
fun foo(): @Foo Int = 1
}
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.FIELD)
annotation class FieldAnn
<caret>@FieldAnn
val x get() = 42
@@ -0,0 +1,7 @@
// "Add annotation target" "true"
@Target(AnnotationTarget.FIELD, AnnotationTarget.PROPERTY)
annotation class FieldAnn
@FieldAnn
val x get() = 42