Fix Java ulong enum literal generation#9017
Open
steadytao wants to merge 1 commit intogoogle:masterfrom
Open
Conversation
Emit Java ulong enum constants as signed long bit-equivalents so values above Long.MAX_VALUE compile correctly. Add a focused Java ulong enum schema and regression test covering constants that previously failed with integer number too large.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Emit Java
ulongenum constants as signedlongbit-equivalents instead of raw unsigned decimal literals.Problem
For Java output,
ulongenum values aboveLong.MAX_VALUEwere emitted as decimallongliterals such as:That does not compile in Java and fails with
integer number too large.Fix
ulongenum constants to their signedlongbit-equivalent before emitting the literallong, which matches the existing Java representation forulongulongenum constants aboveLong.MAX_VALUETesting
integer number too largeLong.parseUnsignedLong(..., 16)Fixes #8610.