RFR: 8273324: IllegalArgumentException: fromIndex(0) > toIndex(-1) after clear and select TableCell

Michael Strauß mstrauss at openjdk.java.net
Fri Sep 3 21:20:07 UTC 2021

On Fri, 3 Sep 2021 19:10:40 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> Can we get a unit test for this case?

This is a test that fails without the fix, and passes with the fix. However, there are no assertions, which is... strange. Once [JDK-8273336](https://bugs.openjdk.java.net/browse/JDK-8273336) is fixed, the test could validate the selection state.

    public void test_jdk_8273324() {
        class Person {
            final String firstName, lastName;
            Person(String firstName, String lastName) {
                this.firstName = firstName;
                this.lastName = lastName;
            public String getFirstName() { return firstName; }
            public String getLastName() { return lastName; }

        var tableView = new TableView<Person>();

        var col1 = new TableColumn<Person, String>();
        col1.setCellValueFactory(new PropertyValueFactory<>("firstName"));
        var col2 = new TableColumn<Person, String>();
        col2.setCellValueFactory(new PropertyValueFactory<>("lastName"));
        tableView.getColumns().addAll(List.of(col1, col2));

        var ab = new Person("a", "b");
        var cd = new Person("c", "d");

        tableView.getSelectionModel().clearAndSelect(0, col1);


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

More information about the openjfx-dev mailing list