[lworld] RFR: 8373202: [lworld] ObjectReference.equals should follow == semantics for value objects [v5]

Serguei Spitsyn sspitsyn at openjdk.org
Fri Jan 23 20:22:06 UTC 2026


On Fri, 23 Jan 2026 03:00:04 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> What happens if not running in preview mode? Value classes are not supported in that case, but as implemented this API will say they are supported, leading to isValueClass() looking at modifiers in a way that is not compatible when value classes are not supported.

It should work correctly. The IDENTITY modifier bit is not used for other purposes in JDK 27 (Alex, please, fix me if it is wrong). So, the check for version >= 27 is needed. If preview is not enabled in target VM, so it does not support value classes then the IDENTITY modifier bit will be always set which results in `isValueClass()` to always return `false`.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1834#discussion_r2722702002


More information about the valhalla-dev mailing list