On Wed, 23 Sep 2026 13:48:30 GMT, Chen Liang <[email protected]> wrote:

>> The identity hash code of value objects currently can produce 0. A zero 
>> value is usually not anticipated for System.identityHashCode calls unless 
>> the argument is null; the 0 hash also cannot be cached. Thus, we should move 
>> away from the 0 hash.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Chen Liang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Rename and comment a bit

I've added a runtime test, and make the code not depend on the magic constant 
0, but instead use `no_hash` more, and tried to adapt naming and comment 
accordingly. Tests are still relying on the fact no_hash is zero, but that is 
hard to avoid, even implicitly, and I think it is acceptable: it is not going 
to change in a foreseeable future.

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

PR Comment: https://git.openjdk.org/jdk/pull/32660#issuecomment-5814252718

Reply via email to