https://kotlinlang.org logo
l

Laurent Laborde

09/16/2022, 9:30 PM
err, i just realized, if my kotlin code isn’t meant to be called from java, i don’t need to use the @throws annotation in my class declaration, right ?
c

Chris Lee

09/16/2022, 9:31 PM
correct
l

Laurent Laborde

09/16/2022, 9:31 PM
pfew, it will be so much more readable ! thx !
👍 1
m

mkrussel

09/16/2022, 9:33 PM
I think having it can still be useful documentation. If you expected it to be handled then document it. If it cannot be handled then don’t (whether you are using it from Java or not).
l

Laurent Laborde

09/16/2022, 9:38 PM
well this one cannot be handled but i’ll keep it in mind. thank you.
j

Johann Pardanaud

09/17/2022, 10:09 AM
The
@throws
annotation is really meant to tell the JVM which checked exceptions the method can throw, and might not be available when compiling to other platforms. If you want to document what your method can throw, use the `@throws class, @exception class` documentation tags, they are platform-agnostic.
👍 1
5 Views