On Wed, 2 Sep 2026 18:40:00 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).

Hello Chen, would it be possible to add a few more details either to the JBS 
description or this PR description about why the hashcode being 0 for some 
value objects isn't ideal? There's also a mention of caching in the issue 
description and code comments. Which cache is being referred to here? Would 
these same concerns apply to value classes that override the `hashCode()` 
method implementation?

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

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

Reply via email to