mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-17 08:31:31 +00:00
23 lines
463 B
Kotlin
Vendored
23 lines
463 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
// FILE: JavaAnn.java
|
|
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
@interface JavaAnn {
|
|
Class<?> value();
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
class OK
|
|
|
|
@JavaAnn(OK::class) class MyClass
|
|
|
|
fun box(): String {
|
|
val ann = MyClass::class.java.getAnnotation(JavaAnn::class.java)
|
|
if (ann == null) return "fail: cannot find JavaAnn on MyClass"
|
|
return ann.value.java.simpleName!!
|
|
}
|