RFR: 8368968: FloatingDecimal: Clean up unused code

Raffaello Giulietti rgiulietti at openjdk.org
Tue Sep 30 17:57:46 UTC 2025


On Tue, 30 Sep 2025 15:35:03 GMT, Johannes Graham <duke at openjdk.org> wrote:

> This is a followup to https://github.com/openjdk/jdk/pull/27118, to clean up resulting unused code.
> - remove `getChars`, `isExceptional` and `isNegative` 
> - remove `ExceptionalBinaryToASCIIBuffer`; throws `IllegalArgumentException` instead of returning an instance of that.(Caller already asserts non-exceptional arg)

src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java line 1553:

> 1551:             if ( fractBits == 0L ){
> 1552:                 throw new IllegalArgumentException((isNegative ? "-" : "+") + INFINITY_REP
> 1553:                 );

Suggestion:

                throw new IllegalArgumentException((isNegative ? "-" : "") + INFINITY_REP);

By convention, positive infinity does not have a + sign.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27581#discussion_r2392402463


More information about the core-libs-dev mailing list