RFR: 8356439: Rename JavaLangAccess::*NoRepl methods [v2]
Volkan Yazici
vyazici at openjdk.org
Tue Aug 12 12:11:15 UTC 2025
On Fri, 8 Aug 2025 17:29:34 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Volkan Yazici 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:
>>
>> - 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
>> - Improve docs of touched methods and add NPE checks
>> - Convert IAE-throwing methods into CCE-throwing ones
>> - Rename `JavaLangAccess::*NoRepl` methods
>
> src/java.base/share/classes/java/lang/String.java line 855:
>
>> 853: int len = val.length >> coder; // assume LATIN1=0/UTF16=1;
>> 854: int en = scale(len, ce.maxBytesPerChar());
>> 855: // Fast-path with `ArrayEncoder` implies replacement.
>
> I recommend documenting this on ArrayEncoder instead.
This already happens to be the case:
/*
* FastPath char[]/byte[] -> byte[] encoder, REPLACE on malformed input or
* unmappable input.
*/
public interface ArrayEncoder { ... }
> src/java.base/share/classes/java/lang/String.java line 949:
>
>> 947: static byte[] getBytesNoReplacement(String s, Charset cs) throws CharacterCodingException {
>> 948: Objects.requireNonNull(s, "s");
>> 949: Objects.requireNonNull(cs, "cs");
>
> #26600 and subsequent PRs will add variable name reporting, so you can omit the string message to reduce bytecode size.
Great news! :star_struck: Simplified as requested in f536a341901.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2269618475
PR Review Comment: https://git.openjdk.org/jdk/pull/26413#discussion_r2269613108
More information about the security-dev
mailing list