Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8339517

Add --enable-native-access flag when running tests

    XMLWordPrintable

Details

    • b10

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              kcr Kevin Rushforth
              kcr Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: