Hmm, Kotlin (on the JVM in this case) defines some...
# announcements
s
Hmm, Kotlin (on the JVM in this case) defines some new exceptions and also aliases some of Java's exceptions (like
kotlin.RuntimeException
is actually just a typealias for
java.lang.RuntimeException
). And all of Kotlin's own exceptions will ultimately inherit from
kotlin.Throwable
, whereas Java's exceptions will inherit from
java.lang.Throwable
). But does that mean that catching
kotlin.Throwable
only won't actually catch e.g. `java.lang.RuntimeException`s?
d
s
Oh, interesting! I just navigated to
kotlin.Throwable
in the IDE and saw this, which made me wonder.
Copy code
public open class Throwable(open val message: String?, open val cause: Throwable?) {
    // ...
}
Thanks!
d
Yeah, there is some compiler magic going on for some of the mapped types.
s
Also, I should've just tried it out in a REPL or something before asking. Was easy enough to find that it got caught as I expected it to. simple smile
Then my problem is something else mysterious. I seem to be getting `java.lang.NullPointerException`s thrown around even if I am catching
kotlin.Throwable
from that call-site. Oh well, back to the drawing board. Thanks, @diesieben07! :D