Throws
@Target
(
[AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR]
)
annotation
class
Throws
(source)
This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
Example:
@Throws(IOException::class)
fun readFile(name: String): String {...}
will be translated to
String readFile(String name) throws IOException {...}
Constructors
Properties
Extension Properties
annotationClass
Returns a KClass instance corresponding to the annotation type of this annotation.
val
<
T
:
Annotation
>
T
.
annotationClass
:
KClass
<
out
T
>