On 4 Nov 2024, at 10:47, Brian Goetz wrote:

> This line:
>
>> *Each method of a value class that has its|ACC_SYNCHRONIZED|flag set must 
>> also have its|ACC_STATIC|flag set.*
>
> makes me think we might want to take this further.  The ACC_SYNCHRONIZED bit 
> was a design mistake; it makes for two ways to do the same thing in the 
> bytecode.  We might consider simply not allowing ACC_SYNC in value classes at 
> all, and either (a) have the compiler simulate the effect of a static sync 
> method by wrapping the body with a suitable sync block, or simply (b) 
> disallowing sync methods in value classes entirely.


This sounds like a siren song:  “I’ve always hated that feature,
and this is a good chance to get rid of it, as we pass by.”

But synchronized, for better or worse, is independent of object
identity, for the static parts of a class.  So there’s no actual
warrant for changing it, other than “we never liked it”.

Reply via email to