posted 1 year ago
The example given by JCIP is not about the safe publication of the reference to the Holder object, but rather the Holder object itself.
A class that is immutable can not guarantee anything about references to its objects, that's the responsibility of the classes that use the immutable class.
The assertSanity() method makes an assertion about n, not about holder.