-
Bug
-
Resolution: Fixed
-
P3
-
1.1
-
1.1
-
sparc
-
solaris_2.5
-
Not verified
The compiler does not generate any code for a synchronized statement with no
code in its block (apparently for optimization purposes). This causes, for
example, the following NOT to throw a NullPointerException as specified in the
JLS 14.17 (page 289):
synchronized (null) {}
And there are important semantics lost by this optimization in the non-null
case as well, such as synchronizing the variables in the thread's working
memory and guaranteeing that the thread will not continue execution until at
least the current holder of the given lock has released it.
code in its block (apparently for optimization purposes). This causes, for
example, the following NOT to throw a NullPointerException as specified in the
JLS 14.17 (page 289):
synchronized (null) {}
And there are important semantics lost by this optimization in the non-null
case as well, such as synchronizing the variables in the thread's working
memory and guaranteeing that the thread will not continue execution until at
least the current holder of the given lock has released it.