G
YouTube TikTok Games
Skip to content

Preserve numeric types for negative hexadecimal minima - #1877

Open
AmarGhugare wants to merge 1 commit into
apache:masterfrom
AmarGhugare:fix/negative-hex-number-types
Open

AmarGhugare wants to merge 1 commit into
apache:masterfrom
AmarGhugare:fix/negative-hex-number-types

Conversation

@AmarGhugare

Copy link
Copy Markdown
Contributor

NumberUtils.createNumber("-0x8000000000000000L") returns BigInteger even though the value is exactly Long.MIN_VALUE and the suffix requests Long. The unsuffixed hexadecimal representation of Integer.MIN_VALUE similarly returns Long instead of Integer.

Recognize the additional representable negative magnitude in the existing 8- and 16-digit range checks, after leading zeros and any long suffix have been accounted for. The numeric values are unchanged; the returned subtype is corrected at those boundaries.

Thirteen regression cases fail without the correction. Coverage includes 0x, 0X, and #, leading zeros, L/l, adjacent out-of-range values, and an explicit Long request for the Integer minimum. Existing positive hexadecimal promotion tests remain in place.

Validation: mvn -o -B -ntp passed on JDK 25.0.4.1: 119,342 tests run, zero failures/errors, and 18 skipped. Coverage, license checks, Checkstyle, binary compatibility, SpotBugs, PMD, and Javadoc checks passed.

Jira filing is pending approval of the Apache Jira account. The reproduction and proposed fix are included here for review in the meantime.

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