RFR: 8295953: Use enhanced-for cycle instead of Enumeration in sun.security

Andrey Turbanov aturbanov at openjdk.org
Wed Oct 26 17:00:06 UTC 2022


On Tue, 18 Oct 2022 17:43:53 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> java.util.Enumeration is a legacy interface from java 1.0.
>> There are a few places with cycles which use it to iterate over collections. We can replace this manual cycle with enchanced-for, which is shorter and easier to read.
>
> src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java line 412:
> 
>> 410:                 ObjectIdentifier findOID = ObjectIdentifier.of(oid);
>> 411:                 for (Extension ex : extensions.getAllExtensions()) {
>> 412:                     ObjectIdentifier inCertOID = ex.getExtensionId();
> 
> Is the old `getElements` method still useful?

It seems it's not used in current codebase anymore. Do you propose to drop it?

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

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



More information about the security-dev mailing list