https://kotlinlang.org logo
Title
d

Davio

02/20/2019, 7:41 AM
I got a nasty NullPointerException because I didn't check the nullability of a return platform type (in my case
String!
); is there an option to treat these platform types as nullable by default, meaning you have to consciously choose to deal with their possible nullability?
1
g

gildor

02/20/2019, 8:17 AM
No, there is no such option
But for your own code you can use JSR-305 annotations
And the reason why it’s not an option by default and even not available, is a lot of different interoperability issues with existing Java APIs, you can hear about details and rationale of this in this talk

https://www.youtube.com/watch?v=2IhT8HACc2E