Files
kotlin-fork/compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt
T
2019-11-19 11:00:09 +03:00

22 lines
499 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.full.declaredMemberProperties
annotation class Ann(val value: String)
public class Bar(public val value: String)
interface Foo {
companion object {
@JvmField @Ann("O")
val FOO = Bar("K")
}
}
fun box(): String {
val field = Foo.Companion::class.declaredMemberProperties.single()
return (field.annotations.single() as Ann).value + (field.get(Foo.Companion) as Bar).value
}