RFR: JDK-8291509 Minor cleanup could be done in sun.security [v3]

Weijun Wang weijun at openjdk.org
Wed Aug 31 22:34:18 UTC 2022


On Wed, 31 Aug 2022 22:25:57 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> Don't know what you mean about changing `toString`. I could change `equals` to something like:
>> 
>> 
>> public boolean equals(Object other) {
>>         if (!(other instanceof PKCS10Attributes))
>>             return false;
>> 
>>         Collection<PKCS10Attribute> othersAttribs =
>>                 ((PKCS10Attributes)other).getAttributes();
>>         PKCS10Attribute[] attrs =
>>                 othersAttribs.toArray(new PKCS10Attribute[0]);
>>         PKCS10Attributes foo = new PKCS10Attributes(attrs);
>>         return this.map.equals(foo.map);
>> }
>
> Sorry, I meant `equals`. Why cannot we just compare with `other.map`?

Ah, I see. The key for an attr might not be the id.

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

PR: https://git.openjdk.org/jdk/pull/9972



More information about the security-dev mailing list