RFR: 8310901: Convert String::newStringNoRepl with Latin-1 to String::newStringLatin1NoRepl [v4]

Glavo duke at openjdk.org
Wed Jun 28 09:02:01 UTC 2023


On Wed, 28 Jun 2023 01:45:51 GMT, Chen Liang <liach at openjdk.org> wrote:

> On a side note, `NoRepl` means "no replication", implying the passed array is already trusted. I think you should do something like this instead:

I think `NoRepl` means "no replace", it's an ambiguous acronym.

It cannot be replaced by `new String(byte[], int, int, Charset)` because the constructor will replaces malformed-input and unmappable-character sequences with this charset's default replacement string.

I think throwing an exception when malformed or unmappable bytes is encountered is a useful behavior, and maybe a new public API should be provided to users.

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

PR Comment: https://git.openjdk.org/jdk/pull/14655#issuecomment-1611031664


More information about the core-libs-dev mailing list