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
Frank Bouwens
11/17/2023, 11:25 AM
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
Erfannj En
11/17/2023, 11:25 AM
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
efemoney
11/17/2023, 4:48 PM
Its almost as if you shouldnt be writing code like this in the first place 🧌