RFR: 8356439: Rename JavaLangAccess::*NoRepl methods [v5]

Chen Liang liach at openjdk.org
Thu Aug 21 13:39:55 UTC 2025


On Thu, 21 Aug 2025 09:39:44 GMT, Volkan Yazici <vyazici at 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 replaces the `NoRepl` suffix with `NoReplacement` in method names and consistently uses `throws CCE` in method footprints.
>
> Volkan Yazici has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits:
> 
>  - Javadoc fix
>  - Cosmetic improvements
>  - Merge remote-tracking branch 'upstream/master' into jlaNoRepl
>  - Remove redundant type parameters
>  - Simplify added null checks
>  - Avoid code duplication by sprinkling some generics magic
>  - 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
>  - ... and 3 more: https://git.openjdk.org/jdk/compare/a7c0f4b8...7af0f351

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

> 1317:     }
> 1318: 
> 1319:     private static <E extends Exception> E malformedInputException(byte[] val, Class<E> exceptionType) {

This one seems only meaningful for ascii. Should we rename this to maybe `malformedAscii`?

test/jdk/java/lang/String/NoReplTest.java line 1:

> 1: /*

Should we rename this to `NoReplacementTest`?

test/jdk/java/lang/String/NoReplTest.java line 2:

> 1: /*
> 2:  * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.

Suggestion:

 * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2291038173
PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2291091134
PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2291091448


More information about the nio-dev mailing list