Files
kotlin-fork/compiler/testData/codegen/box/annotations/instances/javaAnnotation.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

44 lines
837 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// !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
}