https://kotlinlang.org logo
Title
e

elect

05/15/2018, 9:37 AM
I have a
lateinit
in an
object
object offscreenPass {
        ...
        lateinit var commandBuffer: VkCommandBuffer
But whenever I try to query if it has been initialized
if (offscreenPass::commandBuffer.isInitialized)
, I get
Backing field of 'lateinit var commandBuffer: VkCommandBuffer' is not accessible at this point
i

ilya.gorbunov

05/15/2018, 2:08 PM
You can only call
::isInitialized
inside that object, where the backing field of that lateinit is accessible.
e

elect

05/15/2018, 4:04 PM
why is that?
there is no way/workaround to check a the initialization of a
lateinit var
outside the object?