Thomas
07/29/2019, 12:53 PMInvalidMutabilityException
? If you move the init
to the end (after the lazy val) it does not throw the exception.
fun main() {
Example()
}
class Example {
init {
freeze()
}
val value by lazy { 1 }
}
Dominaezzz
07/29/2019, 1:02 PMDominaezzz
07/29/2019, 1:02 PMinit
, then the subclass can't initialize itself.olonho
07/29/2019, 1:16 PMclass Example {
init {
freeze()
}
val value = 1
}
Thomas
07/29/2019, 1:25 PMolonho
07/29/2019, 1:26 PM