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

Alan Bateman alanb at openjdk.org
Thu Aug 28 13:05:52 UTC 2025


On Thu, 28 Aug 2025 10:46:01 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 incrementally with one additional commit since the last revision:
> 
>   Improve docs

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

> 882:     }
> 883: 
> 884:     private static byte[] encodeWithEncoderNoReplacement(Charset cs, byte coder, byte[] val)

I wonder if we should rename this to encodeNoReplacement while we are here because "WithEncoder" suggests it takes an encoder, which isn't the case.

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

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


More information about the security-dev mailing list