mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8340572: ConcurrentModificationException when sorting ArrayList sublists
Reviewed-by: smarks
This commit is contained in:
parent
9a25f822fb
commit
260d4658ae
2 changed files with 60 additions and 1 deletions
|
@ -1808,6 +1808,7 @@ public class ArrayList<E> extends AbstractList<E>
|
|||
@Override
|
||||
public void sort(Comparator<? super E> c) {
|
||||
sortRange(c, 0, size);
|
||||
modCount++;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1816,7 +1817,6 @@ public class ArrayList<E> extends AbstractList<E>
|
|||
Arrays.sort((E[]) elementData, fromIndex, toIndex, c);
|
||||
if (modCount != expectedModCount)
|
||||
throw new ConcurrentModificationException();
|
||||
modCount++;
|
||||
}
|
||||
|
||||
void checkInvariants() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue