On Mon, 21 Jul 2025 12:10:51 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`.) src/java.base/share/classes/java/lang/String.java line 571: > 569: } > 570: > 571: private static String utf8ThrowingIae(byte[] bytes, int offset, int > length) { Iae should be all-caps. `IAE` src/java.base/share/classes/java/lang/String.java line 579: > 577: } > 578: > 579: private static IllegalArgumentException > cce2iae(CharacterCodingException cce) { More readable would be "cceToIAE" But this whole construct is suspect because of the contortions needed. src/java.base/share/classes/java/lang/String.java line 1289: > 1287: } > 1288: > 1289: private static void throwMalformed(byte[] val) throws > MalformedInputException { It is unnecessary to add add @throws of RuntimeExceptions, conventionally they are omitted as clutter and any RuntimeException can be thrown at any time. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2237974608 PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2239826290 PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2239865577