Created PR to remove AbstractStringBuilder.MAX_ARRAY_SIZE -
https://github.com/openjdk/jdk/pull/5878
BTW, I found one more place where Integer.MAX_VALUE is used as maximum
array length -
java.util.concurrent.ScheduledThreadPoolExecutor.DelayedWorkQueue#grow
I think this method could be reworked t
> On 9 Oct 2021, at 13:07, Pavel Rappo wrote:
>
>
>
> Separately, java.lang.AbstractStringBuilder#MAX_ARRAY_SIZE seems unused; I
> wonder how that happened.
I found what happened:
$ git log -S "MAX_ARRAY_SIZE" --
src/java.base/share/classes/java/lang/AbstractStringBuilder.java
commit 036
This error has two causes. The first cause is that the VM cannot allocate
arrays whose length exceeds Integer.MAX_VALUE - 8 (MAX_ARRAY_SIZE). The second
cause is that Arrays.deepToString tries to pre-allocate 20 chars per string
representation for each array element and maxes out at Integer.MAX_