On Tue, 16 Jun 2026 13:59:50 GMT, ExE Boss <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/System.java line 493:
>> 
>>> 491:      *      <div class="preview-comment">
>>> 492:      *          The "identity hash code" of a {@linkplain 
>>> Class#isValue() value object}
>>> 493:      *          is computed by combining the identity hash codes of 
>>> the value object's fields recursively.
>> 
>>> is computed by combining the identity hash codes
>> 
>> Should this be a bit more precise and say "adding" or maybe "summing" 
>> instead of saying "combining"?
>
> They’re “combined”, since they’re not just “summed”, but also “multiplied”:
> https://github.com/openjdk/jdk/blob/892d502abc4ea0a058f3d20ba10899f2a4d90076/src/java.base/share/classes/java/lang/runtime/ValueObjectMethods.java#L167-L171

Thank you @ExE-Boss. I hadn't yet reached to that file in my review, so thank 
you for correcting me. 

Having briefly looked at that implementation, I wonder if we should leave out 
the exact details from this documentation and instead just word it as follows:

> The "identity hash code" of a {@linkplain Class#isValue() value object} is 
> computed using the identity hash codes of all of the value object's fields 
> recursively.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3421439214

Reply via email to