Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-18 Thread Marius Hanl
On Tue, 11 Jan 2022 17:21:13 GMT, Michael Strauß wrote: > The question is whether or not `null` should be a valid value for the > `selectionModel` and `focusModel` properties. I think there are good reasons > to think that it shouldn't. The primitive property classes > (`IntegerProperty`, `Boo

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread Michael Strauß
On Tue, 11 Jan 2022 13:04:52 GMT, Marius Hanl wrote: > When a null value is possible, guards against are needed. Unfortunately there > is no built-in way to forbid null in Java as whole. I think null checks should only be done to verify the preconditions of an operation, and not to guard again

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread Marius Hanl
On Tue, 11 Jan 2022 09:01:51 GMT, John Hendrikx wrote: > ``` > public final MultipleSelectionModel getSelectionModel() { > return selectionModel == null ? null : > selectionModel.get() == NONE_SELECTION_MODEL ? null : > selectionModel.get(); > } > ``` That would work altough I thi

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread John Hendrikx
On Sat, 8 Jan 2022 00:17:36 GMT, Marius Hanl wrote: > This PR fixes a bunch of NPEs when a null `SelectionModel` or `FocusModel` is > set on a `ListView`. > > The following NPEs are fixed (all are also covered by exactly one test case): > NPEs with null selection model: > - Mouse click on a `Li

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-11 Thread Marius Hanl
On Sat, 8 Jan 2022 14:32:30 GMT, John Hendrikx wrote: > Same goes for the selection model; if set to `null` it should not allow any > kind of selection, which again seems best achieved by installing a model that > ignores all such actions and always returns empty values. We had a similar discu

Re: RFR: 8279640: ListView with null SelectionModel/FocusModel throws NPE

2022-01-08 Thread John Hendrikx
On Sat, 8 Jan 2022 00:17:36 GMT, Marius Hanl wrote: > This PR fixes a bunch of NPEs when a null `SelectionModel` or `FocusModel` is > set on a `ListView`. > > The following NPEs are fixed (all are also covered by exactly one test case): > NPEs with null selection model: > - Mouse click on a `Li