...
Note that if Foo
was mutable, the Helper
field would need to be declared volatile
as shown in CON00-J. Ensure visibility of atomically accessed shared primitive variables on accesses. Also, the method getHelper()
is an instance method and the accessibility of the helper
field is private
. This allows safe publication of the Helper
object, in that, a thread cannot observe a partially initialized Foo
object (CON26-J. Do not publish partially-constructed objects).
...