I created https://github.com/openjdk/jfx/pull/323.
On Sat, Oct 17, 2020 at 5:21 PM Kevin Rushforth <[email protected]> wrote: > Yes, this looks like a bug. Would you mind filing it? We could add an > "@defaultValue false" to the property docs as well. The class docs do > indicate false (as you noted), but the property docs are silent on the > default value. > > It looks like the only reason it hasn't caused problems for us is that > the Spinner constructor calls editableProperty() which initializes the > editable field (so the incorrect default value is not used). Still, it > would be good to fix this, since it is a bug waiting to happen if that > initialization were to ever change. > > -- Kevin > > > On 10/16/2020 5:06 AM, Nir Lisker wrote: > > I noticed now that the class docs specify that the default is false. > > Should isEditable() be changed to return false on a null property? > > > > On Fri, Oct 16, 2020 at 2:59 PM Nir Lisker <[email protected]> wrote: > > > >> Hi, > >> > >> Spinner's editable property seems to have conflicting initial values. > >> isEditable() returns true on an uninitialized property, but > initializing it > >> sets its default to false: > >> > >> private BooleanProperty editable; > >> public final void setEditable(boolean value) { > >> editableProperty().set(value); > >> } > >> public final boolean isEditable() { > >> return editable == null ? true : editable.get(); // <---- true > >> } > >> public final BooleanProperty editableProperty() { > >> if (editable == null) { > >> editable = new SimpleBooleanProperty(this, "editable", > false); > >> // <---- false > >> } > >> return editable; > >> } > >> > >> Seeme like a bug. What is the correct default? > >> > >> - Nir > >> > >
