Do not check backing field presence in AnnotationSplitter
This code can be invoked early, during body resolution and before the fact that a property has backing field (which is only known for certain after body resolution, because an implicit 'field' identifier may be used). Since split annotations are cached until the end of the program, they may end up on incorrect elements in the bytecode (or disappear completely) as in KT-29507 or KT-28182. Because the FIELD target has the lowest priority among implicit annotation targets (see TARGET_PRIORITIES), it's safe to always assume that FIELD is a valid target when splitting annotations. This only changes the way annotations are split in case of incorrect code, as changes in test data show. #KT-28182 Fixed #KT-29507 Fixed
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
@field:Field public val x: kotlin.Int = 42
|
||||
@Field public val y: kotlin.Int
|
||||
@field:Field public val y: kotlin.Int
|
||||
|
||||
@Field public final annotation class Another : kotlin.Annotation {
|
||||
public constructor Another()
|
||||
@@ -18,8 +18,8 @@ package
|
||||
}
|
||||
|
||||
public interface His {
|
||||
@Field public abstract val x: kotlin.Int
|
||||
@Field public open val y: kotlin.Int
|
||||
@field:Field public abstract val x: kotlin.Int
|
||||
@field: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
|
||||
@@ -27,11 +27,11 @@ public interface His {
|
||||
|
||||
@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:Field public final val v: kotlin.Int
|
||||
@field:Field public final val w: kotlin.Int
|
||||
@field:Field public final val x: kotlin.Int
|
||||
@Field public final val y: kotlin.Int
|
||||
@Field public abstract val z: kotlin.Int
|
||||
@field:Field public final val y: kotlin.Int
|
||||
@field: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
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ public final class CustomDelegate {
|
||||
|
||||
@Ann public final class SomeClass {
|
||||
public constructor SomeClass()
|
||||
protected final val delegatedProperty: kotlin.String
|
||||
public final val propertyWithCustomGetter: kotlin.Int
|
||||
@field:Ann protected final val delegatedProperty: kotlin.String
|
||||
@field:Ann public final val propertyWithCustomGetter: kotlin.Int
|
||||
@field:Ann protected final val simpleProperty: kotlin.String = "text"
|
||||
@field:Ann protected final val simplePropertyWithAnnotationList: kotlin.String = "text"
|
||||
public final fun anotherFun(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
|
||||
Reference in New Issue
Block a user