RFR: 8258075: Use auto variable declarations for enum iteration

John R Rose jrose at openjdk.java.net
Fri Dec 11 23:15:56 UTC 2020


On Fri, 11 Dec 2020 22:33:33 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 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)

Marked as reviewed by jrose (Reviewer).

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

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


More information about the hotspot-dev mailing list