RFR: 8311170: Simplify and modernize equals and hashCode in security area [v12]

Pavel Rappo prappo at openjdk.org
Tue Aug 8 11:59:00 UTC 2023


On Fri, 4 Aug 2023 21:30:00 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Feedback
>
> src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddress.java line 105:
> 
>> 103:             return false;
>> 104:         if (address != null && h.address != null) {
>> 105:             return Arrays.equals(address, h.address);
> 
> Can't this block be combined into:
> return` addrType == h.addrType && Arrays.equals(address, h.address); `?

Have a look at the end result (commits e71fc42a173 and d9316270976), is it better?

> src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java line 156:
> 
>> 154:             return false;
>> 155:         if (addresses != null && addrs.addresses != null) {
>> 156:             return Arrays.equals(addresses, addrs.addresses);
> 
> Same comment as above, i.e. combined into one return condition.

Same comment as above.

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

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



More information about the security-dev mailing list