On Sun, 29 Sep 2024 17:44:30 GMT, Attila Szegedi <att...@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.

Just an observation, but sorting is not defined as a "structural modification" 
but obviously would interfere with an active iterator. So the docs may need 
updating to include this aspect.

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

PR Comment: https://git.openjdk.org/jdk/pull/21250#issuecomment-2381622959

Reply via email to