to check if the field has been initialized, is there something similar for
Delegates.notNull
?
t
Tobias Berger
09/23/2020, 1:48 PM
No, there isn't. You could write your own delegate implementation (pretty simple in this case) and keep the delegate object in an additional property in addition to the one that delegates to it. Then you could check on the delegate if it's safe to access the value.
Or you just use lateinit var instead.
k
Karlo Lozovina
09/23/2020, 3:06 PM
thanks for the info, will probably go for a custom Delegate, since I can't use lateinit on primitive types...