Can object access be reordered with that object's final field access in Java?
问题 Below code sample is taken from JLS 17.5 "final Field Semantics": class FinalFieldExample { final int x; int y; static FinalFieldExample f; public FinalFieldExample() { x = 3; y = 4; } static void writer() { f = new FinalFieldExample(); } static void reader() { if (f != null) { int i = f.x; // guaranteed to see 3 int j = f.y; // could see 0 } } } Since the instance of FinalFieldExample is published through a data race, is it possible that the f != null check evaluates successfully, yet