RFR: 8311170: Simplify and modernize equals and hashCode in security area [v4]
Pavel Rappo
prappo at openjdk.org
Thu Jul 6 19:04:24 UTC 2023
On Thu, 6 Jul 2023 17:06:31 GMT, Sean Mullan <mullan at openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/x509/X500Name.java line 422:
>>
>>> 420: // quick check that number of RDNs and AVAs match before canonicalizing
>>> 421: if (!Arrays.equals(this.names, other.names,
>>> 422: Comparator.comparingInt(n -> n.assertion.length)))
>>
>> I'd keep the original comparison of the lengths; its a lot less magical than `Comparator.comparingInt(n -> n.assertion.length))`
>
> I tend to agree with Roger. I have to think more about what is being compared with the new code.
Yeah, I assume no matter how one shapes it, it doesn't seem a readability win:
if (!Arrays.equals(this.names, other.names,
(n1, n2) -> Integer.compare(n1.assertion.length, n2.assertion.length))) {
return false;
}
Reverted in 42d9543b769.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1254811720
More information about the security-dev
mailing list