RFR: 8349373: Support JavaFX preview features [v2]

Michael Strauß mstrauss at openjdk.org
Fri Feb 7 15:10:21 UTC 2025


On Tue, 4 Feb 2025 19:47:34 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   move enum field to top
>
> modules/javafx.base/src/main/java/com/sun/javafx/PreviewFeature.java line 52:
> 
>> 50:     private static final String SUPPRESS_WARNING_PROPERTY = "javafx.suppressPreviewBanner";
>> 51: 
>> 52:     private static final boolean enabled = Boolean.getBoolean(ENABLE_PREVIEW_PROPERTY);
> 
> The JDK requires that you opt into preview features _for a specific version_. That is, rather than a boolean, the JDK uses an integer feature release value that must match the current release. They do this by using the `--release` option (in connection with the `--enable-preview`), and compiling that into the class file, which we can't directly use. Maybe we can do something similar, though?

This is only done at compilation time, not at runtime. JEP 12 elaborates on this:

> --enable-preview itself does not take a version number because it would be easy to misinterpret. For example, on JDK 18, the (hypothetical) flag --enable-preview 19 would appear to suggest support for the preview features of JDK 19, but those features are not known at the time of JDK 18's release.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1359#discussion_r1946680175


More information about the openjfx-dev mailing list