[throws] annotation added to the standard library

This commit is contained in:
Andrey Breslav
2014-01-22 18:55:44 +04:00
parent 0f301e0d2a
commit f757881f22
+16
View File
@@ -2,9 +2,25 @@ package kotlin
import java.lang.Class
import java.lang.Object
import java.lang.annotation.*
import jet.runtime.Intrinsic
/**
* This annotation indicates what exceptions should be declared by a function when compiled to a JVM method
*
* Example:
*
* throws(javaClass<IOException>())
* fun readFile(name: String): String {...}
*
* will be translated to
*
* String readFile(String name) throws IOException {...}
*/
Retention(RetentionPolicy.SOURCE)
public annotation class throws(vararg val exceptionClasses: Class<out Throwable>)
[Intrinsic("kotlin.javaClass.property")] public val <T> T.javaClass : Class<T>
get() = (this as java.lang.Object).getClass() as Class<T>