Skip to content

Prune or simplify methods for converting int to enum#684

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_922897756
Open

Prune or simplify methods for converting int to enum#684
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_922897756

Conversation

@copybara-service
Copy link
Copy Markdown

Prune or simplify methods for converting int to enum

For int-to-actual-enum conversions, just use static_cast directly. For enum-like objects (currently Version), CHECK-fail if the value is invalid (similar to what ColorSpaceToInt did previously). This is more brittle, but allows the code to be simplified, and tests strictly assert that the Version values which can be passed from Kotlin match those in native code.

@copybara-service copybara-service Bot force-pushed the test_922897756 branch 3 times, most recently from 6cf6066 to e9c922a Compare May 29, 2026 17:56
For int-to-actual-enum conversions, just use static_cast directly. For enum-like objects (currently Version), CHECK-fail if the value is invalid (similar to what ColorSpaceToInt did previously). This is more brittle, but allows the code to be simplified, and tests strictly assert that the Version values which can be passed from Kotlin match those in native code.

PiperOrigin-RevId: 922897756
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.

1 participant