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

Replace incorrect use of getIndex() in EnumValueDescriptor with getNumber() #226

Merged
merged 2 commits into from
Jul 14, 2022

Conversation

rbtying
Copy link
Contributor

@rbtying rbtying commented Jul 13, 2022

Fixes #225

  1. Best practice for protocol buffers is to use getNumber rather than ordinal on the generated Java enum (which the EnumValueDescriptor's getIndex corresponds to
  2. The cel-go implementation that cel-java is based on uses getNumber
  3. other parts of cel-java use getNumber

Note: the test update corrects the test to do the right thing, but it doesn't fail in the existing (incorrect) implementation because the test enum has getNumber() == getIndex() for all values.

@CLAassistant
Copy link

CLAassistant commented Jul 13, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

Thanks! The test looks good - maybe just add anohter value.

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

Changes LGTM!
Thanks for the fix!

@snazy snazy merged commit 65da64c into projectnessie:main Jul 14, 2022
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.

Protobuf enums inconsistently use ordinal and getNumber
3 participants