RFR: 8340572: ConcurrentModificationException when sorting ArrayList sublists
David Holmes
dholmes at openjdk.org
Tue Oct 1 03:24:37 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.
I agree with just reverting the behaviour as discussed in JBS, but will leave the actual review for the libs folk. The more general question of when to trigger CME is a very thorny one.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21250#issuecomment-2384699577
More information about the core-libs-dev
mailing list