fc87043cb3
Add PropertyDescriptor.backingField/delegateField to store annotations on the field directly in an otherwise almost empty descriptor instance, instead of storing them with use-sites in the corresponding property descriptor. Instead of AnnotationWithTarget, create AnnotationDescriptor instances in AnnotationSplitter. Change DescriptorRenderer to render annotations on "related" declarations when needed, with the explicit use-site target if applicable. Most changes in diagnostic test data are related to the fact that annotations which are known to have an incompatible use-site to the declaration they're applied at (such as `@param:`-annotation on a function), are now not loaded at all. It's fine because the code is erroneous, so it doesn't really matter how do we load annotations with invalid targets (some of this logic is also changed freely in subsequent commits). Some changes are also explained by the fact that for example an annotation on the property which is only applicable to FIELD is now rendered with an explicit use-site target `@field:`, regardless of whether it did have that use-site target syntactically or not. Basically, after this change there's no point in calling Annotations.getUseSiteTargetedAnnotations/getAllAnnotations anymore because it's easier and more intuitive to just use Annotations of the corresponding descriptor -- the backing / delegate field (introduced in this commit) or the extension receiver / setter parameter (related behavior was fixed in previous commits). Usages of use-site-target-related methods will be refactored out in subsequent commits
93 lines
6.6 KiB
Plaintext
Vendored
93 lines
6.6 KiB
Plaintext
Vendored
package
|
|
|
|
package test {
|
|
|
|
public open class AnnotationTargets {
|
|
public constructor AnnotationTargets()
|
|
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 final annotation class base : kotlin.Annotation {
|
|
public constructor base()
|
|
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 fieldann : kotlin.Annotation {
|
|
public constructor fieldann()
|
|
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.CONSTRUCTOR}) public final annotation class konstructor : kotlin.Annotation {
|
|
public constructor konstructor()
|
|
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.LOCAL_VARIABLE}) public final annotation class local : kotlin.Annotation {
|
|
public constructor local()
|
|
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.ANNOTATION_CLASS}) public final annotation class meta : kotlin.Annotation {
|
|
public constructor meta()
|
|
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.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER}) public final annotation class method : kotlin.Annotation {
|
|
public constructor method()
|
|
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.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD}) public final annotation class multiple : kotlin.Annotation {
|
|
public constructor multiple()
|
|
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.VALUE_PARAMETER}) public final annotation class parameter : kotlin.Annotation {
|
|
public constructor parameter()
|
|
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.CLASS, AnnotationTarget.FILE}) public final annotation class type : kotlin.Annotation {
|
|
public constructor type()
|
|
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
|
|
}
|
|
}
|
|
|
|
@test.AnnotationTargets.base @test.AnnotationTargets.meta @test.AnnotationTargets.type @test.AnnotationTargets.method @test.AnnotationTargets.multiple public final class KClass {
|
|
@test.AnnotationTargets.base @test.AnnotationTargets.method @test.AnnotationTargets.konstructor public constructor KClass()
|
|
public constructor KClass(/*0*/ @test.AnnotationTargets.base @test.AnnotationTargets.parameter y: @test.AnnotationTargets.base @test.AnnotationTargets.type kotlin.Int)
|
|
@test.AnnotationTargets.base @test.AnnotationTargets.local @field:test.AnnotationTargets.multiple @field:test.AnnotationTargets.fieldann public final val x: kotlin.Int = 0
|
|
@field:test.AnnotationTargets.fieldann public final val y: @test.AnnotationTargets.base @test.AnnotationTargets.type kotlin.Int
|
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
|
@test.AnnotationTargets.base @test.AnnotationTargets.method @test.AnnotationTargets.multiple @test.AnnotationTargets.konstructor public final fun foo(/*0*/ @test.AnnotationTargets.parameter @test.AnnotationTargets.type i: @test.AnnotationTargets.base @test.AnnotationTargets.multiple kotlin.Int): @test.AnnotationTargets.fieldann @test.AnnotationTargets.parameter kotlin.Int
|
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
|
}
|
|
|
|
@test.AnnotationTargets.base @test.AnnotationTargets.meta @test.AnnotationTargets.type @test.AnnotationTargets.konstructor public final annotation class KMeta : kotlin.Annotation {
|
|
public constructor KMeta()
|
|
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
|
|
}
|
|
}
|