artem_zin
02/14/2017, 10:08 PMlateinit
uses null
as “not-initialized”, at the same time Int
will be interpreted as primitive java int
whenever possible to avoid allocation on heap, that means that combination of any primitive types with lateinit
is not possible because lateinit
needs reference type (for null
) but primitives are not reference types… We’re facing it from time to time and have to fallback to Delegates.notNull()
as suggested before, you can vote for IDE quickfix for that https://youtrack.jetbrains.com/issue/KT-12515