RFR: 8297074: Use enhanced-for cycle instead of Enumeration in javax.crypto

Bradford Wetmore wetmore at openjdk.org
Wed Nov 16 02:09:01 UTC 2022


On Mon, 7 Nov 2022 16:54:32 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.

Since you're down in the code anyway, you might take care of these minor nits as well.

src/java.base/share/classes/javax/crypto/CryptoPermissions.java line 232:

> 230:         // find out if there is anything we should add into
> 231:         // ret.
> 232:         Enumeration<String> thisKeys = this.perms.keys();

There are a couple other places where you could do the same enhanced for loop with arrays:  Current lines: 107, 254, 287.

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

Marked as reviewed by wetmore (Reviewer).

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



More information about the security-dev mailing list