RFR: 8273100: Improve AbstractStringBuilder.append(String) when using CompactStrings [v3]

Claes Redestad redestad at openjdk.java.net
Mon Aug 30 13:57:28 UTC 2021


On Mon, 30 Aug 2021 13:29:56 GMT, Сергей Цыпанов <github.com+10835776+stsypanov at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Simplify and call getBytes(String, int, byte) when possible
>
> src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1730:
> 
>> 1728:     }
>> 1729: 
>> 1730:     private void putStringAt(int index, String str) {
> 
> Can we replace all the calls to this method with calls to previous method as `putStringAt(index, str, 0, str.length())` taking into account that in all usecases `str.length()` is already calculated into a local var?

No, I don't think so. The only use of this I can find is at line 1298 which effectively adds a substring: `putStringAt(dstOffset, (String) s, start, end);`

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

PR: https://git.openjdk.java.net/jdk/pull/5291


More information about the core-libs-dev mailing list