RFR: 8138842: TableViewSelectionModel.selectIndices does not select index 0 [v2]
Karthik P K
kpk at openjdk.org
Wed Feb 1 09:20:06 UTC 2023
On Tue, 31 Jan 2023 19:41:20 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Well it's legal Java code, but that doesn't mean that leaving something `null` is allowed. At the very least it is undocumented behavior:
>>
>> /**
>> * <p>This method allows for one or more selections to be set at the same time.
>> * It will ignore any value that is not within the valid range (i.e. greater
>> * than or equal to zero, and less than the total number of items in the
>> * underlying data model). Any duplication of indices will be ignored.
>> *
>> * <p>If there is already one or more indices selected in this model, calling
>> * this method will <b>not</b> clear these selections - to do so it is
>> * necessary to first call clearSelection.
>> *
>> * <p>The last valid value given will become the selected index / selected
>> * item.
>> * @param index the first index to select
>> * @param indices zero or more additional indices to select
>> */
>> public abstract void selectIndices(int index, int... indices);
>
> I think it is also pretty clear the original author intended to check `rows.length == 0` and made the mistake that it would be called with `rows == null` when there are no further indices specified, which is incorrect.
I believe no code change is required as of now. Hence not making any changes now.
-------------
PR: https://git.openjdk.org/jfx/pull/1018
More information about the openjfx-dev
mailing list