RFR: 8299807: newStringUTF8NoRepl and getBytesUTF8NoRepl always copy arrays

Glavo duke at openjdk.org
Mon Jan 9 18:29:55 UTC 2023


On Mon, 9 Jan 2023 17:07:53 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

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

The `isLatin1()` can only replace `coder == LATIN1`, and it is necessary to check whether it is ASCII.

In the following, we also need to pass the `coder` when calling `encodeUTF8`. Therefore, I think it is clearer to judge the `coder` directly than to call `isLatin1()`.

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

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


More information about the core-libs-dev mailing list