I have noticed some of my Scala classes contain a field with the name bitmap$0
of type int
. What is this?
That's where the initialization states for lazy val
s are stored. When you access a lazy val
(or a nested object
, which is equivalent), the compiler uses the bitmap field to determine whether it's already been evaluated.
When lazy vals are initialized, this field is also used for synchronization when the value is initialized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With