plans to make JavaFX 8 platform independent again?

Tom Schindl tom.schindl at
Wed Feb 17 18:30:00 UTC 2016


In general I think this whole Spinner thing is completely bogus!!!!

Suppose the following:

> Spinner<Integer> s = new Spinner<>(0.0, 1.0, 0.0);
> 			s.valueProperty().addListener( new ChangeListener<Integer>() {
> 				@Override
> 				public void changed(ObservableValue<? extends Integer> observable, Integer oldValue, Integer newValue) {
> 					System.err.println("HELLO WORLD");
> 				}
> 			});
> 			s.increment();

This will naturally give you a CCE. Those constructurs should have never
ever be supplied but what should have be provided is

Spinner.createDouble( double, double, double ) : Spinner<Double>;
Spinner.createInt( int, int, int );

I have not tried but the work around is to explicitly

public Spinner(@NamedArg("valueFactory") SpinnerValueFactory<T>

a) You need your own SpinnerValueFactory because one can not reference
inner classes in FXML

> package application;
> import javafx.beans.NamedArg;
> import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory;
> public class MyWrapperFactory extends IntegerSpinnerValueFactory {
> 	public MyWrapperFactory(@NamedArg("min") int min,
>             @NamedArg("max") int max,
>             @NamedArg("initialValue") int initialValue) {
> 		super(min, max, initialValue);
> 	}
> }

b) make your FXML look like this

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Spinner?>
<?import application.MyWrapperFactory?>

<VBox xmlns:fx="">
			<MyWrapperFactory min="0" max="100" initialValue="3" />

So IMHO action items are:
* deprecate those constructors
* provide static factory methods

The order in which constructors are provided by reflection is not
guaranteed and BTW you can make your sample break on windows. Change
Spinner<Integer> to Spinner<Double>!


On 17.02.16 18:30, Kevin Rushforth wrote:
> Hi Stefan,
> Java and JavaFX are platform-independent, so asking whether we will
> "make it platform-independent again" is asking the wrong question.
> Really, your question should be:  can a fix for a serious bug be
> backported to JDK 8 after it is fixed in JDK 9. The answer to that
> question is "yes" for serious bugs and regressions.
> What you have discovered in this case is a serious bug that happens to
> affect a single platform. In fact, my reading of the bug is that we are
> just getting lucky on the other platforms. If this turns out to be as
> serious as it seems, then I will bump the priority to P2 and we will
> consider a backport to a JDK 8 update release.
> -- Kevin
> Stefan Endrullis wrote:
>> Dear JavaFX team,
>> over years one of the key features of Java was its platform
>> independence.  A Java application would run under Windows, Mac OS, and
>> Linux (if well programmed).
>> Since this is no
>> longer the case.  Once you use the JavaFX Spinner<Integer> component
>> your application will still work under Windows, but will crash under
>> Linux.
>> Since this bug attacks a fundamental feature of Java we expected it to
>> be fixed quite fast and definitely in Java 8.  But now we discover
>> that it's planned to be fixed in Java 9 only.
>> Does this mean that Java 8 is not considered to be platform
>> independent anymore?  Do we have to start deploying different jars for
>> different platforms now?
>> Best regards,
>> Stefan Endrullis

Thomas Schindl, CTO EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck

More information about the openjfx-dev mailing list