Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8258810: Improve enum traits #1868

Closed
wants to merge 4 commits into from

Conversation

kimbarrett
Copy link

@kimbarrett kimbarrett commented Dec 22, 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


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1868/head:pull/1868
$ git checkout pull/1868

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 22, 2020

👋 Welcome back kbarrett! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 22, 2020

@kimbarrett The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Dec 22, 2020
@kimbarrett kimbarrett marked this pull request as ready for review December 22, 2020 18:49
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 22, 2020
@mlbridge
Copy link

mlbridge bot commented Dec 22, 2020

Webrevs

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think assert(size() > 0) is more consistent with preceding documentation than assert_not_empty() in first() and last(). Very subjective though; up to you.

@mlbridge
Copy link

mlbridge bot commented Jan 2, 2021

Mailing list message from Kim Barrett on hotspot-dev:

On Dec 24, 2020, at 3:46 PM, Albert Mingkun Yang <ayang at openjdk.java.net> wrote:

On Tue, 22 Dec 2020 18:45:31 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

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

I think `assert(size() > 0)` is more consistent with preceding documentation than `assert_not_empty()` in `first()` and `last()`. Very subjective though; up to you.

I changed assert_not_empty to use `size() > 0`. The old implementation was equivalent
in context, but not immediately obviously so. `assert_not_empty` just gives a meaningful name
to the condition, and avoids a bit of code repetition.

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@openjdk
Copy link

openjdk bot commented Jan 8, 2021

@kimbarrett This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8258810: Improve enum traits

Reviewed-by: ayang, iklam, lfoltan

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 8, 2021
@kimbarrett
Copy link
Author

Thanks @albertnetymk and @iklam for reviews. Still need another reviewer, since @albertnetymk is not yet a committer.

Copy link
Member

@lfoltan lfoltan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Lois

@mlbridge
Copy link

mlbridge bot commented Jan 12, 2021

Mailing list message from Kim Barrett on hotspot-dev:

Thanks.

@kimbarrett
Copy link
Author

/integrate

@openjdk openjdk bot closed this Jan 12, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 12, 2021
@openjdk
Copy link

openjdk bot commented Jan 12, 2021

@kimbarrett Pushed as commit 2255ab7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@kimbarrett kimbarrett deleted the improve_enum_traits branch January 12, 2021 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
4 participants