Files
kotlin/compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/propertyAnnotation.kt
2018-05-29 09:29:48 +02:00

24 lines
516 B
Kotlin
Vendored

// !API_VERSION: 1.3
// !JVM_DEFAULT_MODE: compatibility
// JVM_TARGET: 1.8
// WITH_REFLECT
annotation class Property(val value: String)
annotation class Accessor(val value: String)
interface Z {
@Property("OK")
@JvmDefault
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
}