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

Chen Liang liach at openjdk.org
Tue Aug 12 16:03:17 UTC 2025


On Tue, 12 Aug 2025 12:11:07 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 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 incrementally with two additional commits since the last revision:
> 
>  - Simplify added null checks
>  - Avoid code duplication by sprinkling some generics magic

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

> 849:     }
> 850: 
> 851:     private static <E extends Exception> byte[] encodeWithEncoder(Charset cs, byte coder, byte[] val) {

Is the type parameter here redundant?

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

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


More information about the security-dev mailing list