RFR: 8196065: ListChangeListener getRemoved() returns items that were not removed. [v5]

Michael Strauß mstrauss at openjdk.java.net
Tue May 11 02:14:01 UTC 2021


On Tue, 11 May 2021 01:50:17 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> The documentation for `ObservableListBase.nextRemove` states that a single change always refers to the current state of the list, which likely means that multiple disjoint removed ranges need to be applied in order, otherwise the next change's `getFrom` doesn't refer to the correct index.
>> 
>> `SelectedItemsReadOnlyObservableList` doesn't apply removals to `itemsRefList`, which means that subsequent removals will refer to the wrong index when retrieving the removed elements. This PR fixes the calculation of the current index.
>
> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
> 
>  - Merge branch 'master' into fixes/JDK-8196065
>    
>    # Conflicts:
>    #	modules/javafx.controls/src/main/java/javafx/scene/control/ControlUtils.java
>  - Cleanup
>  - Fixed clear-and-select change notification
>  - Add failing tests
>  - Cleanup
>  - Added tests
>  - Fix incorrect index when multiple remove changes are handled in SelectedItemsReadOnlyObservableList
>  - Add failing test

I fixed another issue with `ControlUtils.buildClearAndSelectChange`, which led to incorrect change notifications for selected indices. This PR now fixes
1. [8196065](https://bugs.openjdk.java.net/browse/JDK-8196065) ListChangeListener getRemoved() returns items that were not removed.
2. [8255935](https://bugs.openjdk.java.net/browse/JDK-8255935) MultipleSelectionModel provides incorrect 'removed' sub-list in change events
3. The additional scenarios mentioned by @arapte

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

PR: https://git.openjdk.java.net/jfx/pull/478


More information about the openjfx-dev mailing list