On Wed, 10 Mar 2021 17:24:47 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> `Initalize the FX runtime via Platform.startup and then launch an >> Application on another thread (should succeed)` >> I don't think that should succeed. I would expect it to throw an exception. >> If that would be the case, then both startup-methods would result in >> different states, which wouldn't be so good. >> >> I've now restructured the tests. >> It's a total of 4 tests. 2 after Application.launch and 2 after >> Platform.startup. >> In both cases I check what happens, a Application is launched from another >> thread, or from the javafx thread. In all cases an exception is expected. > >> Initalize the FX runtime via Platform.startup and then launch an Application >> on another thread (should succeed) > I don't think that should succeed. I would expect it to throw an exception. > If that would be the case, then both startup-methods would result in > different states, which wouldn't be so good. > > No, this really should succeed. Internally, it is a similar case to what the > special Java launcher method does when launching a Java class that extends > `Application` and which may have a main method that calls > `Application.launch`. We check the various cases of launching an application > with/without it extending `Application` in the tests under > [tests/system/src/test/java/test/launchertest/](https://github.com/openjdk/jfx/tree/master/tests/system/src/test/java/test/launchertest/). To further clarify, `Application.launch` will start the FX platform only if it is not already started by some other means. Then it will (in all cases) run the applicaiton life-cycle. Note this from the `Application` class docs: Life-cycle The entry point for JavaFX applications is the Application class. The JavaFX runtime does the following, in order, whenever an application is launched: 1. Starts the JavaFX runtime, if not already started (see Platform.startup(Runnable) for more information) ... ------------- PR: https://git.openjdk.java.net/jfx/pull/421