Revert "Revert "Instantiation of annotations for JVM IR with the corresponding feature flag""

Fix incorrectly rebased ce0a3a57df

This reverts commit 3d0126d5
This commit is contained in:
Leonid Startsev
2021-07-21 18:22:29 +03:00
parent 54b9ad6bf5
commit 83c1a75c1e
60 changed files with 1593 additions and 64 deletions
@@ -0,0 +1,44 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM_IR
// WITH_RUNTIME
// !LANGUAGE: +InstantiationOfAnnotationClasses
// FILE: A.java
public @interface A {}
// FILE: B.java
public @interface B {
String value();
}
// FILE: C.java
public @interface C {
int[] v1();
String v2();
}
// FILE: D.java
public @interface D {
String value() default "hello";
}
// FILE: b.kt
fun box(): String {
val a = A()
val b = B("OK")
assert(b.value == "OK")
val c = C(v2 = "v2", v1 = intArrayOf(1))
assert(c.v2 == "v2")
// TODO(KT-47702): Looks like we have to force users either to pass default java parameters explicitly
// or hack LazyJavaClassDescriptor/JavaPropertyDescriptor to load annotation param default value,
// because it is not stored currently anywhere.
// val d = D()
val d = D("OK").value
return d
}