On Thu, 23 Feb 2023 15:56:37 GMT, Roger Riggs <rri...@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 1876: > >> 1874: int length = this.count - offset; >> 1875: int valueLength = length << coder; >> 1876: if ((Integer.MAX_VALUE - offset) / count < valueLength) { > > Can this check be done with multiply instead of divide? This was a recommended pattern when I was working on String. It handles arithmetic overflow. Divide magic there would be confusing. ------------- PR: https://git.openjdk.org/jdk/pull/12728