-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: repo-valhalla
-
Component/s: tools
-
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)