RFR: 8316150: Refactor get chars and string size
Jim Laskey
jlaskey at openjdk.org
Mon Oct 16 16:18:19 UTC 2023
On Fri, 22 Sep 2023 11:37:18 GMT, Chen Liang <liach at openjdk.org> wrote:
>> 1. Reduce duplicate stringSize code
>> 2. Move java.lang.StringLatin1.getChars to jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other packages also need to use this method
>
> src/java.base/share/classes/java/util/FormatItem.java line 148:
>
>> 146: int length = DecimalDigits.stringSize(value);
>> 147: this.digits = new byte[length];
>> 148: DecimalDigits.getCharsLatin1(value, length, this.digits);
>
> Sorry missed this one in last round of review. This is wrong if you mix number fornat items and chinese segments in a String Template.
Try again (been on vacation). Not sure I agree with this refactoring. You need to account for UTF16, hence the PUT_CHAR_DIGIT. Recommend you revert and add getCharsLatin1 using the original implementation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1334295471
More information about the core-libs-dev
mailing list