Files
kotlin-fork/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/propertyAnnotation.kt
T
Mikhael Bogdanov 0c0bd67a6b Add new tests
2020-04-09 07:37:30 +02:00

25 lines
537 B
Kotlin
Vendored

// !JVM_DEFAULT_MODE: all-compatibility
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_REFLECT
annotation class Property(val value: String)
annotation class Accessor(val value: String)
interface Z {
@Property("OK")
val z: String
@Accessor("OK")
get() = "OK"
}
class Test : Z
fun box() : String {
val value = Z::z.annotations.filterIsInstance<Property>().single().value
if (value != "OK") return value
return (Z::z.getter.annotations.single() as Accessor).value
}