[lworld] RFR: 8298659: [lworld] ValueObject isSubstutitable comparison of float/double should use raw bits [v2]

Roger Riggs rriggs at openjdk.org
Fri Feb 9 17:38:03 UTC 2024


On Fri, 9 Feb 2024 17:04:53 GMT, Jens Lidestrom <duke at openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert change to ObjectMethods to avoid changing behavior of equals for floats in records.
>>   Create a separate cache of method pointers for substitutablity test for primitives in ValueObjectMethods.
>
> src/java.base/share/classes/java/lang/runtime/ValueObjectMethods.java line 697:
> 
>> 695:      *     this method returns {@code a == b} with the following exception:
>> 696:      *     <ul>
>> 697:      *     <li> For primitive types {@code float} and {@code double} the
> 
> I'm not sure if this is public documentation for users or internal documentation for implementers.
> 
> If this is for users then it might be helpful with a description of what the new equality semantics actually implies for NaNs and the various zeros and infinities.
> 
> Having to look up `toRawBits` and figure it out will be hard for most people.

These are implementation notes; the JLS specifies the behavior of value classes, operations of values, and the details of what it means for a value to be substitutable. Its still open as to how/where the semantics would appear in javadoc.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/998#discussion_r1484619048



More information about the valhalla-dev mailing list