Detect concurrent modifications in ArrayDeque #KT-63355
Remove the ArrayDeque.subList().subList() test for comodification detection. For types that extend AbstractList and to not override subList function, the behavior varies depending on JDK version. With JKD8, the test fails for ArrayDeque. While with JDK9+, it passes.
This commit is contained in:
committed by
Space Team
parent
5f16fb2e4d
commit
c9d8ecc599
@@ -234,6 +234,16 @@ public actual abstract class AbstractMutableList<E> protected actual constructor
|
||||
return _size
|
||||
}
|
||||
|
||||
override fun iterator(): MutableIterator<E> {
|
||||
checkForComodification()
|
||||
return super.iterator()
|
||||
}
|
||||
|
||||
override fun listIterator(index: Int): MutableListIterator<E> {
|
||||
checkForComodification()
|
||||
return super.listIterator(index)
|
||||
}
|
||||
|
||||
private fun checkForComodification() {
|
||||
if (list.modCount != modCount)
|
||||
throw ConcurrentModificationException()
|
||||
|
||||
Reference in New Issue
Block a user