开发者

In compiled Scala, what is the bitmap$0 field?

I 开发者_如何学JAVAhave 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 vals 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜