How to bypass Kotlin null safety! <https://www.li...
# android
f
I had to try it out, and you’re right! https://pl.kotl.in/jwmNL7R0S
e
But it is as expected, right? The order of initialisation makes it in a way that message in outer is not defined yet when asked in the inner class constructor.
👍 1
f
Yes, because of the order or operations, it’s to be expected. But it being a non-nullable val; Would make you think it wouldn’t give you null. Maybe some KLint or Detekt rule should be made to warn about this.
e
Yes, it seems that the result is correct, because in the latest version of Java, the result is equal to null, but the compiler should inform about it anyway.
e
Its almost as if you shouldnt be writing code like this in the first place 🧌
😁 2
k
I dont get it, what does null safety have anything to do with this