Files
kotlin/compiler/testData/codegen/box/annotations/constValInAnnotation.kt
Alexander Udalov 543db380d2 Use isJvmInterface in JVM back-end instead of isInterface
To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
2018-01-24 15:54:35 +01:00

20 lines
368 B
Kotlin
Vendored

// !LANGUAGE: +NestedClassesInAnnotations
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// FILE: Foo.java
@Anno(Anno.CONST)
public class Foo {}
// FILE: Anno.kt
annotation class Anno(val value: Int) {
companion object {
const val CONST = 42
}
}
fun box(): String =
if ((Foo::class.java.annotations.single() as Anno).value == 42) "OK" else "Fail"