RFR: 8258075: Use auto variable declarations for enum iteration

Ioi Lam iklam at openjdk.java.net
Fri Dec 11 22:40:03 UTC 2020


The pattern used in https://github.com/openjdk/jdk/pull/1707

for (vmIntrinsicID index : EnumRange<vmIntrinsicID>{}) {
  nt[as_int(index)] = string;
}

can be further simplified to the following without loss of readability, since the type of `index` would obviously be the type enclosed by `EnumRange<>`

for (auto index : EnumRange<vmIntrinsicID>{}) {
  nt[as_int(index)] = string;
}

(as suggested by John Rose)

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

Commit messages:
 - 8258075: Use auto variable declarations for enum iteration

Changes: https://git.openjdk.java.net/jdk/pull/1751/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1751&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8258075
  Stats: 16 lines in 6 files changed: 0 ins; 0 del; 16 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1751.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1751/head:pull/1751

PR: https://git.openjdk.java.net/jdk/pull/1751


More information about the hotspot-dev mailing list