On Mon, 9 Jan 2023 03:34:55 GMT, Glavo <d...@openjdk.org> wrote:

> `JavaLangAccess::newStringUTF8NoRepl` and 
> `JavaLangAccess::getBytesUTF8NoRepl` are not implemented correctly. They 
> always copy arrays, rather than avoiding copying as much as possible as 
> javadoc says.
> 
> I ran the tier1 test without any new errors.

src/java.base/share/classes/java/lang/String.java line 927:

> 925:         byte[] val = s.value();
> 926:         byte coder = s.coder();
> 927:         if (coder == LATIN1 && isASCII(val)) {

Why don't we just call `s.isLatin1()` instead of `coder == LATIN1 && 
isASCII(val)`?

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

PR: https://git.openjdk.org/jdk/pull/11897

Reply via email to