https://kotlinlang.org logo
#announcements
Title
# announcements
d

Daniele Segato

09/10/2019, 9:44 AM
EDIT: nevermind, I'm an idiot, used the setter
field
, of course he force me to initialize Why does the compiler force me to initialize a variable that is never actually read? the
get()
doesn't ever expose the actual value of
entries
but if I do not include
= null
it complain with
property must be initialized
I might be wrong but I kinda remember it didn't worked like that a couple of months ago (previous versions)
w

wasyl

09/10/2019, 9:45 AM
Aren’t you accessing the field in
if (actual != field)
?
If you don’t initialize it inline and call the setter, you’d have to compare with an uninitialized field
d

Daniele Segato

09/10/2019, 9:46 AM
nevermind, I'm an idiot 😄 i used the
field = actual
thanks for taking the time to answer me @wasyl
👍 1