On Fri, 23 Jun 2023 23:25:25 GMT, 温绍锦 <d...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Long.java line 493:
>> 
>>> 491:                         | H256[((int) lsb) & 0xff]);
>>> 492: 
>>> 493:         return new String(buf, LATIN1);
>> 
>> Note that this isn’t correct when `COMPACT_STRINGS` is `false`, as then 
>> `buf` is always interpreted as having a `coder` of `UTF16`.
>
> where COMPACT_STRINGS is false,  jdk.internal.access.JavaLangAccess#fastUUID 
> using fastUUIDUTF16
> 
> 
>  public String fastUUID(long lsb, long msb) {
>          return String.COMPACT_STRINGS ? Long.fastUUID(lsb, msb) : 
> Long.fastUUIDUTF16(lsb, msb);
> }

There should probably be a check or something at the top of this method that 
`COMPACT_STRINGS` is `true` then, e.g.:

if (!COMPACT_STRINGS) {
        throw new InternalError("...");
}

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1240970991

Reply via email to