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

Weijun Wang weijun at openjdk.org
Wed Oct 26 17:00:05 UTC 2022


On Mon, 17 Oct 2022 21:50:08 GMT, Andrey Turbanov <aturbanov 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?

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

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



More information about the security-dev mailing list