jet.Annotation
Create a supertype for all Kotlin annotations, jet.Annotation. Map java.lang.annotation.Annotation to jet.Annotation and vice versa. Add extension function "annotationType()" to every annotation, similar to java.lang.annotation.Annotation.annotationType() #KT-1620 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package kotlin
|
||||
|
||||
import java.lang.reflect.Proxy
|
||||
|
||||
public fun <T : Annotation> T.annotationType() : Class<out T> {
|
||||
val invocationHandler = Proxy.getInvocationHandler(this)!!
|
||||
val method = this.javaClass.getMethod("annotationType")
|
||||
return invocationHandler.invoke(this, method, array<Object>())!! as Class<out T>
|
||||
}
|
||||
Reference in New Issue
Block a user