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

Glavo duke at openjdk.org
Mon Jun 26 16:01:08 UTC 2023


Added a new method `newStringLatin1NoRepl` to the `JavaLangAccess`.

Reasons:

* Most use cases of `newStringNoRepl` use `ISO_8859_1` as the charset, creating a new shortcut can make writing shorter;
* Since all possible values of `byte` are legal Latin-1 characters, `newStringLatin1NoRepl` **will not throw `CharacterCodingException`**, so users can make the compiler happy without using useless try-catch statements.

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

Commit messages:
 - clean newStringNoRepl1
 - clean newStringNoRepl1
 - Rename jla to JLA
 - Create new method JavaLangAccess::newStringLatin1NoRepl

Changes: https://git.openjdk.org/jdk/pull/14655/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14655&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8310901
  Stats: 66 lines in 4 files changed: 22 ins; 29 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/14655.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14655/head:pull/14655

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


More information about the core-libs-dev mailing list