RFR: 8256362: JavaFX must warn when the javafx.* modules are loaded from the classpath
Kevin Rushforth
kcr at openjdk.java.net
Tue Nov 17 18:16:05 UTC 2020
This fix adds documentation and a warning to clarify that loading the JavaFX modules from the classpath is not a supported configuration. This will not affect deployments that put the JavaFX modular jars on the classpath, but will simply warn that it is an unsupported mode.
JavaFX is built and distributed as a set of named modules, each in its own modular jar file. This supports running both modular and non-modular applications.
The JavaFX runtime expects its classes to be loaded from a set of named `javafx.*` modules, and does not support loading those modules from the classpath. The Java launcher will fail to load applications that extend `javafx.application.Application` unless the `javafx.graphics` module is on the module path.
Applications that do not extend `javafx.application.Application` can be loaded even if the `javafx.*` classes are loaded from the classpath, but this is an unsupported configuration.
This creates the perception that there is a problem with the standard case of loading a subclass of `javafx.application.Application`, since it fails to load in the case where the JavaFX classes are loaded from the classpath. Further, allowing applications to run in an unsupported mode that likely has bugs creates a maintenance burden. Another problem is that when the JavaFX classes are loaded from the classpath, it breaks encapsulation, since we mo longer get the benefit of the java module system.
The primary reason given for application deployments loading the javafx modules on the classpath usually boils down to one of tooling support, although both gradle and maven now support modules as do all of the popular IDEs.
-------------
Commit messages:
- 8256362: JavaFX must warn when the javafx.* modules are loaded from the classpath
Changes: https://git.openjdk.java.net/jfx/pull/354/files
Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=354&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8256362
Stats: 39 lines in 4 files changed: 39 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jfx/pull/354.diff
Fetch: git fetch https://git.openjdk.java.net/jfx pull/354/head:pull/354
PR: https://git.openjdk.java.net/jfx/pull/354
More information about the openjfx-dev
mailing list