RFR: 8340572: ConcurrentModificationException when sorting ArrayList sublists
Chen Liang
liach at openjdk.org
Wed Oct 2 03:35:36 UTC 2024
On Sun, 29 Sep 2024 17:44:30 GMT, Attila Szegedi <attila at openjdk.org> wrote:
> Fixes a regression with #17818 where `ArrayList.subList(…).sort()` started incrementing `ArrayList.modCount` resulting in some cases throwing a `ConcurrentModificationException` where none was thrown before.
>
> This change keeps the optimization from #17818 but restores the behavior where only sorting the `ArrayList` changes the mod count, but sorting its sublists does not.
test/jdk/java/util/ArrayList/Bug8340572.java line 34:
> 32: */
> 33:
> 34: public class Bug8340572 {
Can we give this a descriptive name, like `ConcurrentSubListSort`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21250#discussion_r1783800883
More information about the core-libs-dev
mailing list