arekolek
09/05/2017, 3:25 PMvar res = someJavaFuncThatActuallyReturnsNull()
// res is now SomeJavaType!
// at this point I can start passing 'res' around and later access anything on it and get an NPE, Kotlin didnt help at all
Thread in Slack Conversation
It would be nice if Kotlin warned you when when assigning platform types to non-null properties. Like for example:
class ExampleActivity : Activity {
lateinit var array: IntArray
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
array = intent.getIntArrayExtra("array")
// throws IllegalStateException: getIntArrayExtra("array") must not be null
}
}