delegate use-site targeted annotations: parser, front-end, codegen with some tests #KT-10502 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-01-14 16:28:29 +03:00
parent 474076a550
commit b78d481bb1
29 changed files with 366 additions and 51 deletions
@@ -1,13 +1,23 @@
import kotlin.reflect.KProperty
annotation class AnnProp
annotation class AnnField
annotation class AnnProp2
annotation class AnnGetter
annotation class AnnSetter
annotation class AnnParam
annotation class AnnDelegate
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
}
public class A(@AnnParam @field:AnnField @property:AnnProp2 val x: Int, @param:AnnParam @get:AnnGetter @set:AnnSetter var y: Int) {
@AnnProp @field:AnnField @property:AnnProp2 @get:AnnGetter @set:AnnSetter @setparam:AnnParam
var p: Int = 0
@AnnProp @property:AnnProp2 @delegate:AnnDelegate @property:AnnDelegate
val s: String by CustomDelegate()
}
@@ -1,18 +1,27 @@
@kotlin.jvm.internal.KotlinClass
public final class A {
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private @AnnField field p: int
private final @AnnDelegate @org.jetbrains.annotations.NotNull field s$delegate: CustomDelegate
private final @AnnField field x: int
private field y: int
static method <clinit>(): void
public method <init>(@AnnParam p0: int, @AnnParam p1: int): void
public final @AnnGetter method getP(): int
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final method getX(): int
public final @AnnGetter method getY(): int
private synthetic deprecated final static @AnnProp @AnnProp2 method p$annotations(): void
private synthetic deprecated final static @AnnProp @AnnProp2 @AnnDelegate method s$annotations(): void
public final @AnnSetter method setP(@AnnParam p0: int): void
public final @AnnSetter method setY(p0: int): void
private synthetic deprecated final static @AnnProp2 method x$annotations(): void
}
@java.lang.annotation.Retention
@kotlin.jvm.internal.KotlinClass
public abstract class AnnDelegate
@java.lang.annotation.Retention
@kotlin.jvm.internal.KotlinClass
public abstract class AnnField
@@ -35,4 +44,10 @@ public abstract class AnnProp2
@java.lang.annotation.Retention
@kotlin.jvm.internal.KotlinClass
public abstract class AnnSetter
public abstract class AnnSetter
@kotlin.jvm.internal.KotlinClass
public final class CustomDelegate {
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
}