DZone refcard titled "Core Java Concurrency" states:
Once set, final field values cannot be changed. Marking an object reference field as final does not prevent objects referenced from that field from changing later. For example, a final ArrayList field cannot be changed to a different ArrayList, but objects may be added or removed on the list instance.
and
Final field freeze includes not just the final fields in the object but also all objects reachable from those final fields.
I am not entirely clear about the second statement. Does this mean that if I have a final field in class A of type Class B, which in turn have a final field of type Integer, then final field freeze for an instance of class A completes only after the final field freeze for b.c
have already happened?
public class A{
public final B b = new B();
}
public class B{
public final Integer c = 10;
}