mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
24 lines
507 B
Kotlin
Vendored
24 lines
507 B
Kotlin
Vendored
// FILE: JavaAnn.java
|
|
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
@interface JavaAnn {
|
|
Class<?>[] value();
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
class O
|
|
class K
|
|
|
|
@JavaAnn(O::class, K::class) class MyClass
|
|
|
|
fun box(): String {
|
|
val args = MyClass::class.java.getAnnotation(JavaAnn::class.java).value
|
|
val argName1 = args[0].java.simpleName ?: "fail 1"
|
|
val argName2 = args[1].java.simpleName ?: "fail 2"
|
|
return argName1 + argName2
|
|
}
|