RFR: JDK-8302323 Add repeat methods to StringBuilder/StringBuffer [v3]

Jim Laskey jlaskey at openjdk.org
Tue Feb 28 13:29:55 UTC 2023


On Tue, 28 Feb 2023 10:54:14 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Optimize for empty CharSequence
>
> src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1837:
> 
>> 1835:      * @since 21
>> 1836:      * @throws IllegalArgumentException  if {@code count} is less than zero
>> 1837:      * @throws IndexOutOfBoundsException  if the result overflows the buffer
> 
> IOOBE is for cases when an index is out of range so maybe that should be looked at again.

See above. Removed.

> src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1872:
> 
>> 1870:      * {@code CharSequence} length.
>> 1871:      *
>> 1872:      * @param cs     a {@code CharSequence}
> 
> append(CharSequence, int, int) has  "If s is null, then this method appends characters as if the s parameter was a sequence containing the four characters "null".". It looks like the proposal is to allow cs be null, in which case you'll need similar javadoc. In passing, append(CharSequence) is inheriting the method description from Appendable so it has the wrong parameter name.

Changing

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

PR: https://git.openjdk.org/jdk/pull/12728


More information about the core-libs-dev mailing list