[lworld] RFR: 8361496: [lworld] Treating interfaces as isValue() leads to failed assert [v2]

Chen Liang liach at openjdk.org
Tue Jul 15 22:21:55 UTC 2025


On Tue, 15 Jul 2025 13:39:04 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/value/ValueClass.java line 45:
>> 
>>> 43:     /// This excludes primitives and includes Object.
>>> 44:     public static boolean isValueObjectCompatible(Class<?> fieldType) {
>>> 45:         return PreviewFeatures.isEnabled() && !fieldType.isPrimitive() && (!fieldType.isIdentity() || fieldType == Object.class);
>> 
>> The `fieldType == Object.class` would always be true regardless of enable-preview.
>> That does not seem to be accurate and might be mis-interpreted by a caller.
>
> ?? I enclosed that check in a pair of parentheses so its `||` is checked before any of the `&&`, don't think this returns `true` for `Object.class` without preview enabled.

I will wrap the lines here so it's easier to see the logical precedence.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1504#discussion_r2208820332


More information about the valhalla-dev mailing list