On Fri, 4 Aug 2023 15:11:47 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> 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. Hmm, I see. Thanks for the clarification. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1286381949