RFR: 8356439: Rename JavaLangAccess::*NoRepl methods [v5]
Chen Liang
liach at openjdk.org
Thu Aug 21 13:49:55 UTC 2025
On Thu, 21 Aug 2025 13:29:06 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Volkan Yazici has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits:
>>
>> - Javadoc fix
>> - Cosmetic improvements
>> - Merge remote-tracking branch 'upstream/master' into jlaNoRepl
>> - Remove redundant type parameters
>> - Simplify added null checks
>> - Avoid code duplication by sprinkling some generics magic
>> - Group `String` methods by `doReplace` argument
>> - Merge remote-tracking branch 'upstream/master' into jlaNoRepl
>> - Replace `requireNonNull` with implicit null checks
>> - Merge remote-tracking branch 'upstream/master' into jlaNoRepl
>> - ... and 3 more: https://git.openjdk.org/jdk/compare/a7c0f4b8...7af0f351
>
> src/java.base/share/classes/java/lang/String.java line 891:
>
>> 889: private static <E extends Exception> byte[] encodeWithEncoder(
>> 890: Charset cs, byte coder, byte[] val, Class<E> characterCodingException)
>> 891: throws E {
>
> This is a very curious construct; clever in a way but also a bit magical.
> All the while enabling the caller (using null) to avoid having to declare the exception.
> If there were a concise explanation, that might be useful to future maintainers.
Indeed, this uses the well-known Java 8 sneaky throws trick.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2291128513
More information about the core-libs-dev
mailing list