synchronized block start should really flush fields

This commit is contained in:
peter
2012-04-18 12:07:42 +02:00
parent a58fdb1991
commit 8a6f6f7a9d
6 changed files with 47 additions and 4 deletions
@@ -0,0 +1,20 @@
public class Bar {
private Object field;
private final Object lock = new Object();
public void main() {
synchronized (lock) {
if (field != null) {
return;
}
}
synchronized (lock) {
if (field != null) {
return;
}
if (<warning descr="Condition 'field == null' is always 'true'">field == null</warning>) {
System.out.println();
}
}
}
}