by cesarb · 2y ago · 0 comments
// Java
Baz bar() { return new Baz(); }
// Kotlin
val foo = someJavaObject.bar()
foo now has type Baz! but the moment you declare the type of foo explicitly you're forced to pick, and an NPE check is done at that moment.Probably in some years from now once codebases exclusively use this feature, there would be a way to tell the compiler that the default type (without marker) it is a non-nullable type.
[Source](https://blogs.oracle.com/javamagazine/post/what-are-they-bui...