On Thu, 23 Feb 2023 13:13:43 GMT, Jim Laskey <jlas...@openjdk.org> wrote:

> Add the ability to repeatedly append char and CharSequence data to 
> StringBuilder/StringBuffer.

src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1918:

> 1916:         }
> 1917:         int valueLength = length << UTF16;
> 1918:         if ((Integer.MAX_VALUE - this.count) / count < valueLength) {

I think you can omit this check; the call to ensureCapacityInternal will guard 
against the needed size.

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

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

Reply via email to