Delete Annotations.kt, move "annotationType" to JVM stdlib

This commit is contained in:
Alexander Udalov
2014-02-25 22:17:52 +04:00
parent f63cbcfd6a
commit a6a31878a7
2 changed files with 5 additions and 10 deletions
@@ -1,9 +0,0 @@
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>
}
+5 -1
View File
@@ -1,6 +1,7 @@
package kotlin
import java.lang.annotation.*
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import kotlin.jvm.internal.Intrinsic
/**
@@ -27,3 +28,6 @@ Retention(RetentionPolicy.SOURCE)
public annotation class volatile
[Intrinsic("kotlin.synchronized")] public fun <R> synchronized(lock: Any, block: () -> R): R = block()
public fun <T : Annotation> T.annotationType() : Class<out T> =
(this as java.lang.annotation.Annotation).annotationType() as Class<out T>