Add quick fix to add required target to annotation #KT-20484 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
204d9e3423
commit
9ea9ea1008
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user