On Sun, 27 Nov 2022 13:39:20 GMT, Andrey Turbanov <[email protected]> wrote:
>> This code change removes `getElements()` and `delete()` from `CertAttrSet` >> and all its subclasses. The `getName()` method is moved to `s.s.x.Extension` >> since it's only useful there. >> >> Except for removing lines, the only place where real changes are made are: >> >> 1. `getName()` in `Extension`. >> 2. No need to cast to into a `CertAttrSet` object in >> `CertificateExtensions::parseExtension` at >> https://github.com/openjdk/jdk/pull/10934/files#diff-0b9f279d1a1537d66ce5adf4e2abcff9a15d4905f500539a6cf52e9f6710aef7R108-R109, >> since `getName()` is in `Extension` now. >> 3. No need to call different methods `CertAttrSet::getName` and >> `Extension::getExtensionId::toString` depending on the types in >> `CertificateExtensions::equals` at >> https://github.com/openjdk/jdk/pull/10934/files#diff-0b9f279d1a1537d66ce5adf4e2abcff9a15d4905f500539a6cf52e9f6710aef7L298-L303, >> since the default implementation in `Extension::getName` is already >> returning the OID. >> >> The last 2 points are also true for `CRLExtensions`. > > src/java.base/share/classes/sun/security/x509/NetscapeCertTypeExtension.java > line 281: > >> 279: */ >> 280: public Enumeration<String> getElements() { >> 281: return mAttributeNames.elements(); > > Looks like we can drop `mAttributeNames` now. It was used only here. Good catch. I've fixed it in a commit for https://github.com/openjdk/jdk/pull/11302, somewhat related. ------------- PR: https://git.openjdk.org/jdk/pull/10934
