Details
-
Bug
-
Resolution: Fixed
-
P3
-
11, 14
-
b32
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8236896 | 15 | Ivan Gerasimov | P3 | Resolved | Fixed | b06 |
JDK-8238137 | 14.0.1 | Unassigned | P3 | Resolved | Fixed | b02 |
JDK-8246764 | 13.0.4 | Unassigned | P3 | Resolved | Fixed | b05 |
JDK-8236895 | 11.0.7-oracle | Ivan Gerasimov | P3 | Resolved | Fixed | b02 |
JDK-8237518 | 11.0.7 | Ivan Gerasimov | P3 | Resolved | Fixed | b01 |
Description
When a sublist of a sublist is created, its modCount is copied from the root ArrayList, not the immediate parent.
This means that modifying that 2nd-level sublist will reset the modCount of its parent, so it won't detect concurrent modifications to the root.
Similar issue is happening with the sublist's iterator: When an iterator for an ArrayList.SubList is created, its expectedModCount is set to root.modCount (i.e. the modCount of the ArrayList), while it would be more accurate to set it to SubList.this.modCount (i.e. the modCount of the SubList).
With the current implementation, if the root ArrayList is modified immediately before creating the SubList.iterator not via this SubList, the iterator will fail to detect the concurrent modification.
This means that modifying that 2nd-level sublist will reset the modCount of its parent, so it won't detect concurrent modifications to the root.
Similar issue is happening with the sublist's iterator: When an iterator for an ArrayList.SubList is created, its expectedModCount is set to root.modCount (i.e. the modCount of the ArrayList), while it would be more accurate to set it to SubList.this.modCount (i.e. the modCount of the SubList).
With the current implementation, if the root ArrayList is modified immediately before creating the SubList.iterator not via this SubList, the iterator will fail to detect the concurrent modification.
Attachments
Issue Links
- backported by
-
JDK-8236895 Modifying ArrayList.subList().subList() resets modCount of subList
- Resolved
-
JDK-8236896 Modifying ArrayList.subList().subList() resets modCount of subList
- Resolved
-
JDK-8237518 Modifying ArrayList.subList().subList() resets modCount of subList
- Resolved
-
JDK-8238137 Modifying ArrayList.subList().subList() resets modCount of subList
- Resolved
-
JDK-8246764 Modifying ArrayList.subList().subList() resets modCount of subList
- Resolved
- relates to
-
JDK-8079136 Accessing a nested sublist leads to StackOverflowError
- Closed
- links to
(1 relates to, 1 links to)