RFR: 8318486: Rename JavaLangAccess.newString/getBytesUTF8NoRepl to FailFast

Chen Liang liach at openjdk.org
Thu Oct 19 07:11:18 UTC 2023


Please review a patch that renames `JavaLangAccess::newStringUTF8NoRepl` and `getBytesUTF8NoRepl` to `newStringUTF8FailFast` and `getBytesUTF8FailFast` to accurately describe these APIs. This also renames other associated methods.

NoRepl means "no replication", which is not what these APIs are for. They instead expose the fail-fast construction fast-path in String, allowing `ZipCoder` to quickly throw encoding exceptions wrapped in `IllegalArgumentException` without going through decoders and encoders.

In addition, there is already `newStringNoRepl` and `getBytesNoRepl` in `JavaLangAccess` that actually avoids copying arrays for trusted usages, further increasing the confusion. Given these internal APIs are frequently used in recent contributions around improving string performance, I believe a rename of these APIs is necessary.

Pinging @cl4es for a review since you use this particular API the most often.

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

Commit messages:
 - Rename JavaLangAccess.newString/getBytesUTF8NoRepl to FailFast

Changes: https://git.openjdk.org/jdk/pull/16260/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16260&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8318486
  Stats: 13 lines in 4 files changed: 0 ins; 0 del; 13 mod
  Patch: https://git.openjdk.org/jdk/pull/16260.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16260/head:pull/16260

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



More information about the security-dev mailing list