New JEP: Warnings for Identity-Sensitive Libraries

Dan Smith daniel.smith at oracle.com
Thu Jan 30 20:39:49 UTC 2025


I've created a small JEP as a follow-up to JEP 390 (Warnings for Value-Based Classes, delivered in 16).

https://bugs.openjdk.org/browse/JDK-8340476

JEP 390 introduced javac warnings about synchronization attempts on value-based classes (including the wrapper classes), which will become errors when synchronizing on a value object. This JEP produces similar warnings for uses of identity-sensitive libraries with value-based classes, which will throw exceptions when operating on value objects.

(JEP 390 also had a HotSpot diagnostic for the 'monitorenter' instruction, which we don't have an analog for here, because it didn't seem worthwhile, and we don't really have a mechanism for library diagnostics.)

This JEP doesn't depend on value classes or other big features, so I'm envisioning getting it into the 25 release.



More information about the valhalla-spec-experts mailing list