https://kotlinlang.org logo
Title
p

pavel

09/27/2018, 11:38 PM
I would guess that you are making wrong assumptions of the evaluation order
:yes: 1
j

JT

09/28/2018, 1:19 AM
What's weird here is that if I declare
private var collapsedMaxLines: Int = 0
everything works as expected, the value gets assigned to 5 in the method called by the super constructor and stays 5. However if I initialized the var to any non-zero value, it seems to get re-assigned to that value after the constructor method sets it to 5. In order to set the value in the constructor method - the declaration and initialization of the variable has to have already taken place - right?
o

orangy

09/28/2018, 5:31 AM
Int
is a primitive type here, so it has zero as default value – no initialization necessary.