Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
I have a code which looks like: public void go() { final float FINAL = getValue(); for (...) { if (FINAL != getValue()) { System.out.println("FAIL"); } } } float getValue() { return 6; } Being run with G1 and -Xcomp the value of the FINAL variable may change... The source is attached. # java -Xmx300m -XX:+UseG1GC -Xmixed TestFinalFloat Final value: 6.0 Still passed Still passed Still passed Final values has changed: -8.532477E32 TEST FAILED
|