Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/regressions/kt1932.kt
T
Mikhail Glukhikh eab288bdd7 annotation() now has no arguments. Syntax migration to Retention / Repeatable / MustBeDocumented combination
Deprecated test for annotation(params) completion deleted. A lot of tests changed.
2015-09-04 19:21:12 +03:00

24 lines
537 B
Kotlin
Vendored

import java.lang.annotation.Annotation
@Retention(AnnotationRetention.RUNTIME)
annotation class foo(val name : String)
class Test() {
foo("OK") fun hello(input : String) {
}
}
fun box(): String {
val test = Test()
for (method in javaClass<Test>().getMethods()!!) {
val anns = method?.getAnnotations() as Array<Annotation>
if (!anns.isEmpty()) {
for (ann in anns) {
val fooAnn = ann as foo
return fooAnn.name
}
}
}
return "fail"
}