RFR: 8257466: Improve enum iteration [v3]

Kim Barrett kbarrett at openjdk.java.net
Thu Dec 3 04:32:16 UTC 2020


> Please review this collection of improvements to the recently added enum
> iteration facility. These improvements are based on usage in some
> in-development changes.
> 
> (1) Added EnumType nested type to EnumRange and EnumIterator. It is an alias
> for the enum type that is a template parameter for those classes. This is
> useful when dealing with a range or iterator whose associated enum type is
> not known because the range/iterator is a template parameter.
> 
> (2) Added EnumRange<T>::index(T), which converts the argument enumerator to
> a zero-based index into the range of values. This is useful when mapping
> from an enumerator to a corresponding array index, for example.
> 
> (3) Allow enum range bounds to be specified using start and (exclusive) end
> integral (underlying type) values. This is useful when dealing with enums
> that are just value ranges and don't have named enumerators. As part of
> this, changes the enum iteration traits mechanism to use start/end rather
> than first/last, as that seems to be a little easier to deal with.
> 
> (4) Added accessors for the first and last enumerator values of a range.
> 
> (5) Added gtest for enum iteration.
> 
> Testing: tier1

Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'master' into improve_enum_iter
 - iklam review
 - 8257466: Improve enum iteration

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1530/files
  - new: https://git.openjdk.java.net/jdk/pull/1530/files/6911c0fa..ef12da9d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1530&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1530&range=01-02

  Stats: 8229 lines in 320 files changed: 6262 ins; 1006 del; 961 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1530.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1530/head:pull/1530

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


More information about the hotspot-dev mailing list