RFR: 8356202: Cleanup Source code in String Implementation Classes [v2]

Andrey Turbanov aturbanov at openjdk.org
Fri Oct 3 13:08:02 UTC 2025


On Thu, 2 Oct 2025 16:17:32 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Code cleanup in java.lang.StringLatin1 and StringUTF16.
>> Remove the `public` qualifier from methods where it is not needed.
>> Remove an unused toBytes method.
>> Remove unused codePointXXX methods.
>> Remove unnecessary casts of primitive types.
>> 
>> Some of these are suggested by IntelliJ, if the advice should not be taken, I'll revert and update the IDE settings.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert to insensitive.

src/java.base/share/classes/java/lang/StringLatin1.java line 240:

> 238: 
> 239:     static int lastIndexOf(byte[] src, int srcCount,
> 240:                                   byte[] tgt, int tgtCount, int fromIndex) {

let's fix alignment

src/java.base/share/classes/java/lang/StringLatin1.java line 318:

> 316: 
> 317:     static String replace(byte[] value, int valLen, byte[] targ,
> 318:                                  int targLen, byte[] repl, int replLen)

let's align parameters

src/java.base/share/classes/java/lang/StringLatin1.java line 369:

> 367:     // case insensitive
> 368:     static boolean regionMatchesCI(byte[] value, int toffset,
> 369:                                           byte[] other, int ooffset, int len) {

let's align parameters

src/java.base/share/classes/java/lang/StringLatin1.java line 383:

> 381: 
> 382:     static boolean regionMatchesCI_UTF16(byte[] value, int toffset,
> 383:                                                 byte[] other, int ooffset, int len) {

let's align parameters

src/java.base/share/classes/java/lang/StringUTF16.java line 734:

> 732:     // srcCoder == UTF16 && tgtCoder == UTF16
> 733:     static int lastIndexOf(byte[] src, int srcCount,
> 734:                                   byte[] tgt, int tgtCount, int fromIndex) {

let's align parameters

src/java.base/share/classes/java/lang/StringUTF16.java line 833:

> 831: 
> 832:     static String replace(byte[] value, int valLen, boolean valLat1,
> 833:                                  byte[] targ, int targLen, boolean targLat1,

let's align parameters

src/java.base/share/classes/java/lang/StringUTF16.java line 948:

> 946: 
> 947:     static boolean regionMatchesCI(byte[] value, int toffset,
> 948:                                           byte[] other, int ooffset, int len) {

let's align parameters

src/java.base/share/classes/java/lang/StringUTF16.java line 953:

> 951: 
> 952:     static boolean regionMatchesCI_Latin1(byte[] value, int toffset,
> 953:                                                  byte[] other, int ooffset,

let's align parameters

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401838339
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401840513
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401841641
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401841514
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401843867
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401844148
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401844348
PR Review Comment: https://git.openjdk.org/jdk/pull/27609#discussion_r2401844493


More information about the core-libs-dev mailing list