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

Fix #550 #585

Merged
merged 1 commit into from
Jul 6, 2024
Merged

Fix #550 #585

merged 1 commit into from
Jul 6, 2024

Conversation

CaryCatZ
Copy link
Contributor

This PR fixes #550 and provides a test.

Additionally, I found that the previous version attempts twice to match the upper/lower case version,
so I think it is okay to use equalsIgnoreCase.

@mkarg
Copy link
Collaborator

mkarg commented Jul 6, 2024

Thank you for this contribution!

Can you please proof where the original code allowed to match case-insensitive?

@CaryCatZ
Copy link
Contributor Author

CaryCatZ commented Jul 6, 2024

Okay. In this line, it attempts to match using the passed specific name. It catches an IllegalArgumentException exception in the following line. According to the document, this exception occurs when the passed specific name does not match any constant, in this case, it attempts to match again using toUpperCase method (maybe because name of a constant is recommended to be all upper case). This indicates it may match case-insensitive.

@mkarg
Copy link
Collaborator

mkarg commented Jul 6, 2024

This does not imply case-insensitivity. It still is case sensitive, but it comapares to either the original variant or the all-uppercase variant. According to SemVer, we cannot change behavior or minor releases. Hence I would propose to split the PR in two: One for the next minor release containing solely the actual bug fix, while all other changes / enhancements should go in a second PR for the next major release.

@CaryCatZ
Copy link
Contributor Author

CaryCatZ commented Jul 6, 2024

I think it is okay to split this PR. I will edit the code to restore the original behaviour and the issue changes case sensitivity will be raised later.

Copy link
Collaborator

@mkarg mkarg left a comment

Choose a reason for hiding this comment

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

LGTM, but please fix the copyright header, so I can merge your contribution. :-)

Copy link
Collaborator

@mkarg mkarg left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! 👍

@mkarg mkarg merged commit 3bc0804 into cbeust:master Jul 6, 2024
1 check passed
@CaryCatZ CaryCatZ deleted the issue-550 branch July 6, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Enum::toString to print but Enum#valueOf(Enum::name) to match
2 participants