Well, if you look @Throws:
If there is a specific getter that does not use a support field, simply annotate it directly:
val bar: Bar
@Throws(RemoteException::class) get() = doSomething()
Acceptable goals for @Throwsare
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.CONSTRUCTOR
, , :
@get:Throws(RemoteException::class)
:
- ( Java);
- ;
- get ( getter);
- set (set setter);
- ( );
- param ( );
- setparam ( );
- delegate (, ).
@get , .
interface Foo: Remote {
@get:Throws(RemoteException::class)
val bar: Bar
}
, - throws. , , . CONSTRUCTOR FUNCTION , , .
Kotlin, , this:
interface ReplStateFacade : Remote {
@Throws(RemoteException::class)
fun getId(): Int
...
}
, @Throws.
, ?