Check backing field availability for AnnotationTarget.FIELD #KT-10387 Fixed
Some duplicated checks deleted (UseSiteTargetChecker / JvmFieldApplicabilityChecker)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class Field
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
annotation class Another
|
||||
|
||||
@Field
|
||||
val x: Int = 42
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
val y: Int
|
||||
get() = 13
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
abstract class My(<!WRONG_ANNOTATION_TARGET!>@Field<!> arg: Int, @Field val w: Int) {
|
||||
@Field
|
||||
val x: Int = arg
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
val y: Int
|
||||
get() = 0
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
abstract val z: Int
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
fun foo() {}
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
val v: Int by <!UNRESOLVED_REFERENCE!>Delegates<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>lazy<!> { 42 }
|
||||
}
|
||||
|
||||
enum class Your {
|
||||
@Field FIRST
|
||||
}
|
||||
|
||||
interface His {
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
val x: Int
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@Field<!>
|
||||
val y: Int
|
||||
get() = 42
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package
|
||||
|
||||
@Field() public val x: kotlin.Int = 42
|
||||
@Field() public val y: kotlin.Int
|
||||
|
||||
@Field() public final annotation class Another : kotlin.Annotation {
|
||||
public constructor Another()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FIELD}) public final annotation class Field : kotlin.Annotation {
|
||||
public constructor Field()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface His {
|
||||
@Field() public abstract val x: kotlin.Int
|
||||
@Field() public open val y: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@Field() public abstract class My {
|
||||
public constructor My(/*0*/ @Field() arg: kotlin.Int, /*1*/ w: kotlin.Int)
|
||||
@Field() public final val v: kotlin.Int
|
||||
@Field() public final val w: kotlin.Int
|
||||
@Field() public final val x: kotlin.Int
|
||||
@Field() public final val y: kotlin.Int
|
||||
@Field() public abstract val z: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@Field() public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final enum class Your : kotlin.Enum<Your> {
|
||||
@Field() enum entry FIRST
|
||||
|
||||
private constructor Your()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: Your): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
@kotlin.Deprecated(level = DeprecationLevel.ERROR, message = "Use 'values()' function instead", replaceWith = kotlin.ReplaceWith(expression = "this.values()", imports = {})) public final /*synthesized*/ val values: kotlin.Array<Your>
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): Your
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<Your>
|
||||
}
|
||||
+2
-2
@@ -18,10 +18,10 @@ class SomeClass {
|
||||
@field:[Ann]
|
||||
protected val simplePropertyWithAnnotationList: String = "text"
|
||||
|
||||
@field:Ann
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@field:Ann<!>
|
||||
protected val delegatedProperty: String by CustomDelegate()
|
||||
|
||||
<!INAPPLICABLE_FIELD_TARGET_NO_BACKING_FIELD!>@field:Ann<!>
|
||||
<!WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@field:Ann<!>
|
||||
val propertyWithCustomGetter: Int
|
||||
get() = 5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user