JDK-8325993 : Bump minimum JDK version for JavaFX to JDK 21
  • Type: CSR
  • Component: javafx
  • Sub-Component: build
  • Priority: P3
  • Status: Provisional
  • Resolution: Unresolved
  • Fix Versions: jfx23
  • Submitted: 2024-02-15
  • Updated: 2024-02-17
Related Reports
CSR :  
Description
Summary
-------

Update the minimum version needed to run JavaFX to JDK 21.

Problem
-------

In order for JavaFX to be able to use newer JDK features, such as code snippets (in API docs), record patterns, pattern matching for switch statements, and so forth, we need to increase the minimum version of the JDK that can run the latest JavaFX. Additionally, there is an ongoing cost to keeping JavaFX buildable and runnable on older versions of Java, and very little reason to continue to do so.

Solution
--------

Use `javac --release 21` to generate the class files that make up the JavaFX modules, except for the `javafx.swing` module where we will use `-source 21 -target 21`. The `javafx.swing` module requires the `jdk.unsupported.desktop` module, which is excluded by `--release NN`. Using `-source 21 -target 21` is functionally equivalent, although it doesn't provide protection against accidentally using APIs that are present in the boot JDK with which we build JavaFX, but are unavailable in JDK 21. Care must be taken not to introduce a dependency on a too-new API by the `javafx.swing` module. As that module is unlikely to evolve, this is not much of a concern.

Specification
-------------

The class files in all JavaFX modules will be version 65.0 class files, meaning that they will only run on JDK 21 or newer.

The following diffs will be applied to the JavaFX 23 release notes:

```
-JavaFX 22 requires JDK 17 or later.
+JavaFX 23 requires JDK 21 or later.
```

Comments
Moving to Provisional.
16-02-2024