RFR: 8367324: Avoid redundant parsing when formatting with DigitList [v3]

Raffaello Giulietti rgiulietti at openjdk.org
Wed Sep 24 14:46:52 UTC 2025


On Wed, 24 Sep 2025 14:41:07 GMT, Johannes Graham <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/text/DigitList.java line 326:
>> 
>>> 324:         boolean hasBeenRoundedUp = fdConverter.digitsRoundedUp();
>>> 325:         boolean valueExactAsDecimal = fdConverter.decimalDigitsExact();
>>> 326:         assert !fdConverter.isExceptional();
>> 
>> Maybe move this `assert` line at method entry.
>
> I moved it up as high as it can go. Alternatively, could be replaced with an assertion against the `source` parameter - `assert Double.isFinite(source)` ?

Even better!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27118#discussion_r2376052985


More information about the core-libs-dev mailing list