In your day to day programming, do you jump back and forth between writing Kotlin and Swift code as I do? You’ve also probably noticed that you develop muscle memory as you type the keywords. The two languages are quite similar and this lets me be quite productive in both. Yet, there is one set of keywords in particular that gets me every time: val
let
let
val
Tag: kotlin
‘lateinit’ modifier is not allowed on properties of a type with nullable
I was developing an abstract & generic base class where the generic parameter defines the type of an abstract field. This field would be initialized by inherited classes, so I applied the 'lateinit'
modifier to it which caused an interesting error: 'lateinit' modifier is not allowed on properties of a type with nullable