RFR: 8367703: Unneeded cast in java.text.DigitList.append
Justin Lu
jlu at openjdk.org
Thu Sep 18 21:35:51 UTC 2025
On Mon, 15 Sep 2025 21:18:12 GMT, Justin Lu <jlu at openjdk.org> wrote:
> During parse routines, DecimalFormat uses DigitList to append digits from the parsed text.
>
> Note that `digit` is always the int value 0 through 9 (and subsequently the code point 48 through 57) when passed to `append`.
>
> Currently, `append` accepts a char which forces an int -> char -> byte conversion to be stored in `digits`. This can be simplified to int -> byte if the parameter type for the method is updated. The two call sites can safely make this swap.
>
> Tiers 1-3 and java.text JCK tests continue to pass with this change.
For reference, existing case of casting the result of adding a `char` and `int` to `byte` directly in DigitList when storing in `digits`.
https://github.com/openjdk/jdk/pull/27300/files#diff-9950f1f11fffb5ed95549f1067ca7359957b5e8ef89c153d5b1d394edf5df28eL642
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27300#issuecomment-3309790833
More information about the core-libs-dev
mailing list