RFR: JDK-8285263 Minor cleanup could be done in java.security [v5]

Mark Powers duke at openjdk.java.net
Wed Jun 8 22:59:40 UTC 2022


On Wed, 8 Jun 2022 16:12:36 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> Mark Powers has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits:
>> 
>>  - Merge
>>  - fourth iteration
>>  - Merge
>>  - Merge
>>  - third iteration
>>  - Merge
>>  - Merge
>>  - second iteration
>>  - Merge
>>  - Merge
>>  - ... and 1 more: https://git.openjdk.java.net/jdk/compare/4d6fb515...44140a01
>
> src/java.base/share/classes/java/security/cert/PKIXBuilderParameters.java line 193:
> 
>> 191:     public String toString() {
>> 192:         return "[\n" +
>> 193:                 super.toString() +
> 
> Is `toString` necessary?

No it's not necessary. I had some discussion with Brad and others about boxing vs unboxing. The same byte code is generated either way, so to box or unbox is a matter of personal preference.

> src/java.base/share/classes/java/security/spec/ECPoint.java line 103:
> 
>> 101:         return obj instanceof ECPoint other
>> 102:                 && ((Objects.equals(x, other.x))
>> 103:                 && (Objects.equals(y, other.y)));
> 
> `x` and `y` will not be null unless this is `POINT_INFINITY`, but this is already checked in both `equals` and `hashCode`.

I'm reversing IntelliJ's suggested fix since it really doesn't fix anything.

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

PR: https://git.openjdk.java.net/jdk/pull/8319



More information about the security-dev mailing list