RFR: 8347753: VetoableListDecorator doesn't accept its own sublists for bulk operations [v2]
Michael Strauß
mstrauss at openjdk.org
Mon Jan 27 18:34:30 UTC 2025
> Passing a `VetoableListDecorator.subList()` to any of its bulk operations (`addAll`, `setAll`, `removeAll`, `retainAll`) throws `ConcurrentModificationException`. The reason is that the `VetoableListDecorator.modCount` field is incremented before the underlying list's bulk operation is invoked, which causes a mismatch when the sublist is interrogated by the bulk operation.
>
> However, simply updating the `modCount` field _after_ the underlying list was modified also doesn't work, as in this case listeners can't see the correct value for `modCount` in their callback. The fix is to make a defensive copy of the sublist before invoking the underlying list's bulk operation.
Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
- update tests
- update tests
- check list content in tests
- Merge branch 'master' into fixes/vetoable-list-decorator-sublist
- allow sublists to be used for bulk operations
- failing tests
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1679/files
- new: https://git.openjdk.org/jfx/pull/1679/files/5ba5a110..81917761
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1679&range=01
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1679&range=00-01
Stats: 13067 lines in 126 files changed: 4301 ins; 7476 del; 1290 mod
Patch: https://git.openjdk.org/jfx/pull/1679.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1679/head:pull/1679
PR: https://git.openjdk.org/jfx/pull/1679
More information about the openjfx-dev
mailing list