Reflection: add KAnnotatedElement.findAnnotation

#KT-12250 Fixed
This commit is contained in:
Alexander Udalov
2016-07-12 19:54:30 +03:00
parent 414daef001
commit c811c1bea5
7 changed files with 89 additions and 0 deletions
@@ -0,0 +1,15 @@
// 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"
}