RFR: 8193286: IntegerSpinnerFactory does not wrap value correctly

Kevin Rushforth kcr at openjdk.java.net
Wed Apr 15 23:20:58 UTC 2020

On Mon, 13 Apr 2020 06:59:08 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

> Issue : https://bugs.openjdk.java.net/browse/JDK-8193286
> Root Cause :
> Incorrect implementation.
> Current implementation of int wrapValue(int,int,int) in Spinner.java works well if min is 0.
> Hence this implementation works with ListSpinnerValueFactory, but fails with IntegerSpinnerValueFactory.
> Fix :
> Added a method for IntegerSpinnerValueFactory with separate implementation.
> Testing :
> Added unit tests to test increment/decrement in multiple steps and with different amountToStepBy values.
> Also, identified a related behavioral issue https://bugs.openjdk.java.net/browse/JDK-8242553, which will be addressed
> separately.

I'm not sure this is quite right, but I need to look at it more closely. It should fix the bug in question for
well-behaved values, but might make it possible to return a value outside the range of [min, max].

I also want to think about it in light of [JDK-8242553](https://bugs.openjdk.java.net/browse/JDK-8242553). While a
partial fix seems OK, we need to avoid the situation where some values cause a change from one buggy behavior to a
different buggy behavior on the way to fixing it right.


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

More information about the openjfx-dev mailing list