Suggest "Add annotation target" quick fix also for field use-site
So #KT-23227 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
e328d2d1ca
commit
a67068d37e
@@ -0,0 +1,9 @@
|
||||
// "Add annotation target" "true"
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
|
||||
class Test {
|
||||
@field:Ann<caret>
|
||||
var foo = ""
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add annotation target" "true"
|
||||
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class Ann
|
||||
|
||||
class Test {
|
||||
@field:Ann
|
||||
var foo = ""
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Add annotation target" "false"
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ERROR: '@field:' annotations could be applied only to properties with backing fields
|
||||
// ERROR: This annotation is not applicable to target 'member property with delegate' and use site target '@field'
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
|
||||
class Test {
|
||||
@field:Ann<caret>
|
||||
val baz: String by lazy { "" }
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Add annotation target" "false"
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ACTION: Specify type explicitly
|
||||
// ERROR: This annotation is not applicable to target 'member property without backing field or delegate' and use site target '@field'
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
|
||||
class Test {
|
||||
@field:Ann<caret>
|
||||
var bar
|
||||
get() = ""
|
||||
set(p) {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
|
||||
@field:Ann<caret>
|
||||
var foo = ""
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class Ann
|
||||
|
||||
@field:Ann
|
||||
var foo = ""
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Add annotation target" "false"
|
||||
// WITH_RUNTIME
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ERROR: '@field:' annotations could be applied only to properties with backing fields
|
||||
// ERROR: This annotation is not applicable to target 'top level property with delegate' and use site target '@field'
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
|
||||
@field:Ann<caret>
|
||||
val baz: String by lazy { "" }
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Add annotation target" "false"
|
||||
// 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' and use site target '@field'
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
|
||||
@field:Ann<caret>
|
||||
var bar
|
||||
get() = ""
|
||||
set(p) {}
|
||||
Reference in New Issue
Block a user