RFR: 8256397: MultipleSelectionModel throws IndexOutOfBoundException
Jeanette Winzenburg
fastegal at openjdk.java.net
Tue Nov 17 12:41:00 UTC 2020
On Mon, 16 Nov 2020 14:41:57 GMT, Florian Kirmaier <fkirmaier at openjdk.org> wrote:
> Fixing IndexOutOfBoundsException in the MultipleSelectionModelBase and added a unit-test for it.
> ticket: https://bugs.openjdk.java.net/browse/JDK-8256397
> run test: `./gradlew --continue -PFULL_TEST=true controls:test --tests "*MultipleSelectionModelImplTest*"`
good catch :)
No review, just a couple of comments:
- other subclasses of MultipleSelectionModelBase might have similar issues
- the fix gets rid of the error (good!) but might fire incorrect changes (see below)
- there are quite a lot of open issues related to change notification, some might profit from a fix of this
- tests, tests, tests .. :)
selectIndices might involve disjoint intervals in the change (even for addition which is unusual in the "normal" implementations of observableLists)
// initial selection, starting from empty
selectionModel.selectIndices(0, /*1, IMPORTANT: remove some index */ 2, 3);
System.out.println(change);
// expected and actual change
{ [0, 2, 3] added at 0 }
// add selection of disjoint indices (assuming a longer items list)
selectionModel.selectIndices(1, 5, 7);
System.out.println(change);
// actual
{ [1, 2, 3] added at 1 }
// expected
{ [1] added at 1, [5, 7] added at 4 }
-------------
PR: https://git.openjdk.java.net/jfx/pull/353
More information about the openjfx-dev
mailing list