[lworld] RFR: 8346307: [lworld] Clarify identity vs value in Class, Objects, and document limitations of value objects [v4]
Roger Riggs
rriggs at openjdk.org
Wed Feb 19 19:45:57 UTC 2025
On Sun, 16 Feb 2025 15:15:14 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Class.java line 713:
>>
>>> 711: @PreviewFeature(feature = PreviewFeature.Feature.VALUE_OBJECTS, reflective=true)
>>> 712: public boolean isValue() {
>>> 713: return PreviewFeatures.isEnabled() ? !isIdentity() : false;
>>
>> Is there a reason this isn't just `PreviewFeatures.isEnabled() && !isIdentity()`?
>
> Indeed, this API is returning `false` for interfaces and primitive types if preview features are not enabled, which is wrong. Making it simply return `!isIdentity()` may be better and conforms to the javadoc specification here. See https://github.com/openjdk/valhalla/blob/991ec927a2a111e5021b12be3413dfc96efbc74a/src/hotspot/share/prims/jvm.cpp#L1333-L1337
Corrected in 68dd3fb675d0f87da8de2bc7525d5bcc2a87dac1
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1327#discussion_r1962271307
More information about the valhalla-dev
mailing list