RFR: 8351443: Improve robustness of StringBuilder [v5]

Roger Riggs rriggs at openjdk.org
Mon May 5 18:02:50 UTC 2025


On Mon, 5 May 2025 17:38:55 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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.

How about in another PR.  None of the `public static ` methods in StringUTF16 or StringLatin1 need to be public. But it will make this PR very noisy for the wrong reasons.

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

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


More information about the core-libs-dev mailing list