On Fri, 22 Sep 2023 09:22:04 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 incrementally with one additional commit > since the last revision: > > restore HexDigits & OctalDigits private static final MethodHandle PUT_CHAR_DIGIT; static { try { Lookup lookup = MethodHandles.lookup(); PUT_CHAR_DIGIT = lookup.findStatic(FormatItem.class, "putByte", MethodType.methodType(void.class, byte[].class, int.class, int.class)); } catch (ReflectiveOperationException ex) { throw new AssertionError("putByte lookup failed", ex); } } private static void putByte(byte[] buffer, int index, int ch) { buffer[index] = (byte)ch; } int length = DecimalDigits.INSTANCE.size(value); DecimalDigits.INSTANCE.digits(value, this.digits, length, PUT_CHAR_DIGIT); In the current implementation, FormatItem only calls DecimalDigits using the encoding of LATIN1 ------------- PR Comment: https://git.openjdk.org/jdk/pull/15699#issuecomment-1731821226