RFR: 8258810: Improve enum traits

Kim Barrett kbarrett at openjdk.java.net
Tue Dec 22 18:53:06 UTC 2020


Please review these miscellaneous improvements to the enum iteration facility.
Thanks to @albertnetymk for discussions.

(1) Removed some unneeded stuff from EnumIterationTraits.

(2) Various similar bits of error checking code are unified and shared via
EnumIterationTraits.

(3) Casts between the enum type and the underlying type are now done using
helper functions in EnumIterationTraits.

(4) JDK-8257466 added accessors for the EnumRange bounds and the index for
an enumerator, but didn't account for the possibility of an empty subrange.
Add assertions for that case.

(5) Added some death tests to verify some of the error checking.

Testing:
mach5 tier1

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

Commit messages:
 - Improve enum traits and tests

Changes: https://git.openjdk.java.net/jdk/pull/1868/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1868&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8258810
  Stats: 104 lines in 2 files changed: 78 ins; 8 del; 18 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1868.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1868/head:pull/1868

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


More information about the hotspot-dev mailing list