Files
kotlin/compiler/testData/codegen/box/reflection/annotations/findAnnotation.kt
Alexander Udalov c811c1bea5 Reflection: add KAnnotatedElement.findAnnotation
#KT-12250 Fixed
2016-12-07 21:45:24 +03:00

16 lines
289 B
Kotlin
Vendored

// IGNORE_BACKEND: JS
// WITH_REFLECT
import kotlin.reflect.findAnnotation
annotation class Yes(val value: String)
annotation class No(val value: String)
@Yes("OK")
@No("Fail")
class Foo
fun box(): String {
return Foo::class.findAnnotation<Yes>()?.value ?: "Fail: no annotation"
}