-
Bug
-
Resolution: Fixed
-
P3
-
jfx24
-
b10
JEP 472 [0] is a step along the path to restricting JNI access by default. It was recently integrated into JDK 24 by JDK-8331671.
When running JavaFX applications with JDK 24, we now get illegal access warnings of the following form:
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.sun.glass.utils.NativeLib
Loader in module javafx.graphics (file:build/shims/javafx.graphics/)
WARNING: Use --enable-native-access=javafx.graphics to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
In order to avoid those warnings, and to avoid the eventual errors in the future, we need to pass the --enable-native-access flag when running tests, as follows:
--enable-native-access=javafx.graphics,javafx.media,javafx.web
Note that --enable-access has been implemented at least as far back as JDK 21, so we won't need to qualify the passing of that flag based on the JDK we are using to build and test JavaFX.
[0] https://openjdk.org/jeps/472
When running JavaFX applications with JDK 24, we now get illegal access warnings of the following form:
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.sun.glass.utils.NativeLib
Loader in module javafx.graphics (file:build/shims/javafx.graphics/)
WARNING: Use --enable-native-access=javafx.graphics to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
In order to avoid those warnings, and to avoid the eventual errors in the future, we need to pass the --enable-native-access flag when running tests, as follows:
--enable-native-access=javafx.graphics,javafx.media,javafx.web
Note that --enable-access has been implemented at least as far back as JDK 21, so we won't need to qualify the passing of that flag based on the JDK we are using to build and test JavaFX.
[0] https://openjdk.org/jeps/472
- relates to
-
JDK-8340005 Eliminate native access calls from javafx.swing
- Resolved
-
JDK-8340004 [TestBug] Call ModuleLayer.Controller::enableNativeAccess directly rather than via reflection
- Open
-
JDK-8331671 Implement JEP 472: Prepare to Restrict the Use of JNI
- Resolved
- links to
-
Commit(master) openjdk/jfx/4f1d42af
-
Review(master) openjdk/jfx/1562