RFR: 8276220: Reduce excessive allocations in DateTimeFormatter [v3]
Joe Darcy
darcy at openjdk.java.net
Wed Nov 3 13:26:16 UTC 2021
On Wed, 3 Nov 2021 12:17:09 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java line 3544:
>>
>>> 3542: BigDecimal valueBD = BigDecimal.valueOf(value).subtract(minBD);
>>> 3543: BigDecimal fraction = valueBD.divide(rangeBD, 9, RoundingMode.FLOOR);
>>> 3544: // stripTrailingZeros bug
>>
>> I believe this bug was fixed a while back, so this code could be simplified.
>
> Got a reference to which bug this was and how it manifests?
If you're referring to JDK-6480539: "BigDecimal.stripTrailingZeros() has no effect on zero itself ("0.0")", it was fixed in JDK 8.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6188
More information about the core-libs-dev
mailing list