On Tue, 12 Aug 2025 19:29:28 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 incrementally with one additional 
> commit since the last revision:
> 
>   Remove redundant type parameters

It seems that the API is overloaded trying to satisfy too many requirements, 
replace/noreplace, throw/nothrow and supporting arbitrary Charsets.  There are 
multiple callers that only need to create a string from byte array holding 
latin1.
They are burdened with catching and ignoring exceptions that do not occur.

I'm suggesting breaking out that use case in 
PR#https://github.com/openjdk/jdk/pull/26831.
That leaves `Files.readString` that needs the full CharSet/noReplace/throw 
behavior.

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

PR Comment: https://git.openjdk.org/jdk/pull/26413#issuecomment-3201113471

Reply via email to