your brackets look off - what happens if you do mo...
# getting-started
i
your brackets look off - what happens if you do mode?.equals
n
@infini : Yes, minor typo while copy pasting and removing irrelavant pieces from code. I haven’t tried that
mode?.
part. But shouldn’t the lazy be invoked only when I first try to access it, which is after the framework inits all the
vars
a
@nayanjyoti your mode can't be null
the only way that
mode == null
is possible via reflection
can you post the Exception?
n
the value of mode is set via reflection by the framework. And I’m sure it is not null. unfortunately I don’t have the stacktrace now and since it was something on deadlines I went to make a function in the data class which does the same thing only.
a
is it working with a regular function?
n
Yes. I added a
Copy code
fun getStatus()
which does the same thing as above, and it is working.
k
Can you try the
?.
thing? If that works there's a problem with your framework.
n
I will try it probably tomorrow, however, I wanted to know how exactly lazy works? Can you point me to any resource where I can learn more about it?
d
Navigate with IDEA into the
lazy
function call to learn how it works
If you want to quickly receive help with your specific use case, show code we can run and see the problem or at least provide a stacktrace
Side-note: avoiding reflection prevents such weird problems