RFR: 8351443: Improve robustness of StringBuilder [v5]

Chen Liang liach at openjdk.org
Mon May 5 17:41:48 UTC 2025


On Mon, 5 May 2025 17:34:43 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Refactor to consistently use `isLatin1(coder)` within AbstractStringBuilder.
>
> src/java.base/share/classes/java/lang/StringUTF16.java line 1531:
> 
>> 1529:     }
>> 1530: 
>> 1531:     public static void putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
> 
> Hello Roger, can this (pre-existing) method and the other `putCharsAt` that we are changing here, be changed to package private instead of `public`? As far as I can see, these 2 are only accessed from `java.lang.AbstractStringBuilder` which resides in the same package as this class.

In fact, `StringUTF16` and `StringLatin1` are both package-private, so technically all their method access modifiers should either be package-private or private.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24967#discussion_r2073887894


More information about the core-libs-dev mailing list