mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
JVM: Support using KClass as annotation parameter type
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class OK {}
|
||||
|
||||
@Ann(arg=OK.class)
|
||||
class Test {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import kotlin.reflect.KClass
|
||||
import java.lang.annotation.*
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation
|
||||
class Ann(val arg: KClass<*>)
|
||||
|
||||
fun box(): String {
|
||||
val argName = javaClass<Test>().getAnnotation(javaClass<Ann>()).arg.simpleName ?: "fail 1"
|
||||
return argName
|
||||
}
|
||||
Reference in New Issue
Block a user