On Fri, 22 Sep 2023 04:10:26 GMT, 温绍锦 <d...@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
>
> 温绍锦 has updated the pull request with a new target base due to a merge or a 
> rebase. The pull request now contains eight commits:
> 
>  - rebase from master & refactor digits
>  - rebase from master
>  - Merge remote-tracking branch 'upstream/master' into 
> refactor_get_chars_and_string_size
>    
>    # Conflicts:
>    #  src/java.base/share/classes/java/lang/StringLatin1.java
>  - add comment
>  - fix build error
>  - fix build error
>  - move StringLatin1::getChars to 
> jdk.internal.util.DecimalDigits::getCharsLatin1
>  - move *::stringSize to jdk.internal.util.DecimalDigits::stringSize

Changes requested by liach (Author).

src/java.base/share/classes/java/util/FormatItem.java line 248:

> 246:         public long prepend(long lengthCoder, byte[] buffer) throws 
> Throwable {
> 247:             MethodHandle putCharMH = selectPutChar(lengthCoder);
> 248:             HexDigits.getCharsLatin1(value, (int)lengthCoder, buffer);

This is wrong if the coder is UTF16

src/java.base/share/classes/java/util/FormatItem.java line 296:

> 294:         public long prepend(long lengthCoder, byte[] buffer) throws 
> Throwable {
> 295:             MethodHandle putCharMH = selectPutChar(lengthCoder);
> 296:             OctalDigits.getCharsLatin1(value, (int)lengthCoder, buffer);

Same, wrong for UTF16

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

PR Review: https://git.openjdk.org/jdk/pull/15699#pullrequestreview-1639167213
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1333894410
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1333894660

Reply via email to