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

deviant

03/25/2017, 11:49 AM
actually i would use
notNull()
delegate for just marking property as non null instead of lateinit.
lateinit
is rather a hack that exposes public field for easier dependency injection via frameworks such as Dagger, Spring etc.
p

Paul Woitaschek

03/25/2017, 1:12 PM
deviant: what's wrong with lateinit? I think not null is just the because lateinit was not when it was added to the stdlib
d

deviant

03/25/2017, 1:30 PM
they are different though. as i said
lateinit
exposes public field, so it can be acsessible from java directly. on the other hand
notNull
generates some little overhead, because it is a property delegate. also
notNull
allows you to use
val
, that can be useful sometimes
2 Views