On Fri, 8 Aug 2025 13:38:31 GMT, Volkan Yazici <vyaz...@openjdk.org> wrote:

>> `NoRepl`-suffixed `String` methods denote methods that do not replace 
>> invalid characters, but throw `CharacterCodingException` on encounter. This 
>> behavior cannot easily be derived from the method footprints, has been a 
>> source of confusion for maintainers, and is not uniformly adopted, e.g., 
>> `newStringUTF8NoRepl()` and `getBytesUTF8NoRepl()` does *not* throw `CCE`. 
>> This PR removes `NoRepl` suffix from method names and consistently uses 
>> `throws CCE` in method footprints. (b4845109e18 passes `tier1,2`.)
>
> Volkan Yazici has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains seven additional 
> commits since the last revision:
> 
>  - Group `String` methods by `doReplace` argument
>  - Merge remote-tracking branch 'upstream/master' into jlaNoRepl
>  - Replace `requireNonNull` with implicit null checks
>  - Merge remote-tracking branch 'upstream/master' into jlaNoRepl
>  - Improve docs of touched methods and add NPE checks
>  - Convert IAE-throwing methods into CCE-throwing ones
>  - Rename `JavaLangAccess::*NoRepl` methods

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

> 853:         int len = val.length >> coder;  // assume LATIN1=0/UTF16=1;
> 854:         int en = scale(len, ce.maxBytesPerChar());
> 855:         // Fast-path with `ArrayEncoder` implies replacement.

I recommend documenting this on ArrayEncoder instead.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2263641162

Reply via email to