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

[TestBug] Call ModuleLayer.Controller::enableNativeAccess directly rather than via reflection

    XMLWordPrintable

Details

    Description

      JDK-8339517 updated our tests to run the Java launcher with `--enable-native-access` when running tests to avoid the native access warnings that result from JEP 472. See JDK-8331671.

      We have two tests that dynamically load the JavaFX modules at runtime using a ModuleLayer. Those tests need to call ModuleLayer.Controller::enableNativeAccess to enable native access for the JavaFX modules. This method is a preview feature in JDK 21, so cannot be called directly if we happen to build and test JavaFX with JDK 21. As such, when I added the calls to enableNativeAccess as part of JDK-8339517, I did so using reflection.

      Once we bump the minimum JDK to 22, the reflection calls should be replaced with direct calls to enableNativeAccess. See JDK-8340003.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: