valhalla-spec-comments post from jackammo77 at gmail.com requires approval
scolebourne at joda.org
Wed Feb 20 12:21:22 UTC 2019
On Wed, 20 Feb 2019 at 01:05, John Rose <john.r.rose at oracle.com> wrote:
> For me, I think we should all work on getting used to
> the idea that some Java objects *should not* be
> synchronizable. Well, that's already true, but let's
> give our JVM permission to diagnose that particular
> "should not" with an IllegalMonitorStateException
> or something like that. Bad? Yes, but the least-bad,
> where value types are concerned.
Is there a way to ease the pain? Probably you've considered this, but what if...
* Add a new interface NativeSynchronizable with wait/notify methods from Object
* Code compiled using JDK 13 or later only allows
synchronization/wait/notify on objects implementing
* But all class files compiled on JDK 12 or earlier are implicitly
made to implement NativeSynchronizable (ie. interface injected at
class load time based on the ClassFile version number)
* All this can happen before and separate to value types
Would this not avoid the problems with older codebases?
More information about the valhalla-dev