On Fri, 4 Aug 2023 00:04:03 GMT, Valerie Peng <valer...@openjdk.org> wrote:

>> Pavel Rappo has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Feedback
>
> src/java.base/share/classes/sun/security/provider/certpath/CertId.java line 
> 182:
> 
>> 180:             myhash += Arrays.hashCode(issuerNameHash);
>> 181:             myhash += Arrays.hashCode(issuerKeyHash);
>> 182:             myhash += certSerialNumber.getNumber().hashCode();
> 
> It seems that for some other classes, you may just use 
> Objects.hash(hashAlgId, issuerNameHash, issuerKeyHash, 
> certSerialNumber.getNumber())? Is there a rule on what to use?

We can be more aggressive in some refactorings, but I note that if any of the 
hashCode components are arrays, the proper, albeit slightly inconvenient way to 
combine all the components would be `Arrays.deepHashCode(Object[])`, not 
`Objects.hash(Object... values)` or `Arrays.hashCode(Object[])`. The latter two 
don't recurse into arrays, but use their "shallow" hashCode.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1284546168

Reply via email to