RFR: 8316150: Refactor get chars and string size

Shaojin Wen duke at openjdk.org
Mon Oct 16 16:18:19 UTC 2023


On Fri, 22 Sep 2023 12:09:48 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> 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.

Have a great vacation! Enjoy your time off! I made a lot of changes, including removing the use of MethodHandler in FormatItem. I'm not in a hurry. You can handle the review after you come back from vacation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1334996675


More information about the core-libs-dev mailing list