...
The getHelper()
method publishes the mutable helper
field. Because the Helper
class is immutable, it cannot be changed after it is initialized.
. Furthermore, because Helper
is immutable, it is always constructed properly before its reference is made visible, in compliance with TSM03-J. Do not publish partially initialized objects. Unfortunately, a separate thread could observe a stale reference in the helper
field of the Foo
class.
...