On Tue, 27 Jun 2023 07:45:34 GMT, Glavo <d...@openjdk.org> wrote: >> Added a new method `newStringLatin1NoRepl` to the `JavaLangAccess`. >> >> Reasons: >> >> * Most use cases of `newStringNoRepl` use `ISO_8859_1` as the charset, >> creating a new shortcut can make writing shorter; >> * Since all possible values of `byte` are legal Latin-1 characters, >> `newStringLatin1NoRepl` **will not throw `CharacterCodingException`**, so >> users can make the compiler happy without using useless try-catch statements. > > Glavo has updated the pull request with a new target base due to a merge or a > rebase. The incremental webrev excludes the unrelated changes brought in by > the merge/rebase. The pull request contains seven additional commits since > the last revision: > > - Merge branch 'openjdk:master' into latin1-no-repl > - Merge branch 'openjdk:master' into latin1-no-repl > - update javadoc > - clean newStringNoRepl1 > - clean newStringNoRepl1 > - Rename jla to JLA > - Create new method JavaLangAccess::newStringLatin1NoRepl
The goal of removing the try/catch from HexFormat can be solved locally by creating a private method in HexFormat that swallows the exception. There is no need to add a method to Java Lang Access or change 3 other files. The method `newStringUTF8NoRepl` is different, it can/does throw runtime exceptions but there is no need for try/catch in that case, no change is needed there. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14655#issuecomment-1610209289