-
Bug
-
Resolution: Fixed
-
P4
-
repo-valhalla
-
generic
-
generic
JEP 401 states:
It is an error if the operand type of a synchronized statement is any subtype of PrimitiveObject, including any primitive reference type.
// --
This program compiles fine, but fails at runtime:
public primitive class X {
public static void main(String [] args) {
X.ref x = X.default;
synchronized (x) {}
}
}
// when run:
Exception in thread "main" java.lang.IllegalMonitorStateException
at X.main(X.java:4)
It is an error if the operand type of a synchronized statement is any subtype of PrimitiveObject, including any primitive reference type.
// --
This program compiles fine, but fails at runtime:
public primitive class X {
public static void main(String [] args) {
X.ref x = X.default;
synchronized (x) {}
}
}
// when run:
Exception in thread "main" java.lang.IllegalMonitorStateException
at X.main(X.java:4)