On Tue, 27 Apr 2021 19:18:59 GMT, mstr2 <github.com+43553916+ms...@openjdk.org> wrote:
>> This PR fixes the implementation of `ControlUtils.reducingChange`, which >> incorrectly computed adjacent removed indices, thus resulting in incorrect >> removal notifications. >> >> Since there were no unit tests for this method, I also added a bunch of >> tests. >> >> After applying this fix, I can no longer reproduce >> [JDK-8189354](https://bugs.openjdk.java.net/browse/JDK-8189354) and >> [JDK-8189228](https://bugs.openjdk.java.net/browse/JDK-8189228). > > mstr2 has updated the pull request incrementally with one additional commit > since the last revision: > > Use MockListObserver The fix looks good to me. Performed a regressive testing on TreeTableView and TreeView. Though there is an existing issue that SelectionModel.getSelectedItems() and SelectionModel.getSelectedIndices() are incorrect when some intermediate change events are received. Also, I agree with Jeanette on that the two issues in discussion seem different. The AIOOB Exception is not reproducible with TreeView. But I found another NPE with TreeView which gets fixed by this PR. Steps: 1. Run the test program attached to [JDK-8189228](https://bugs.openjdk.java.net/browse/JDK-8189228) 2. Select/Click any child of root for instance 4 Item 1 3. Ctrl click the same item to deselect it -> Observe the NPE This gets fixed by this PR. The issues that are currently listed in the bug [JDK-8189228](https://bugs.openjdk.java.net/browse/JDK-8189228) are not reproducible, so it can be closed as cannot reproduce or May be we should update the description of [JDK-8189228](https://bugs.openjdk.java.net/browse/JDK-8189228) to include this NPE and add that bug to this PR ? modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeTableViewTest.java line 6654: > 6652: root.setExpanded(true); > 6653: > 6654: TreeTableView<String> treeView = new TreeTableView<>(root); rename variable as `treeTableView` modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeViewTest.java line 3704: > 3702: observer.check1(); > 3703: observer.checkAddRemove(0, > treeView.getSelectionModel().getSelectedItems(), List.of(c1, c2, c3), 1, 1); > 3704: } These test validate the getRemoved() list. I think we should also have a test for exception. ------------- Changes requested by arapte (Reviewer). PR: https://git.openjdk.java.net/jfx/pull/480