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

The jar tool should support allowing access to restricted methods from executable jars

XMLWordPrintable

    • jar

      The Foreign Function & Memory API (FFM API) introduces the notion of "restricted methods". These methods are part of the Java SE API, but calling them will result in a runtime warning (the warning might become an exception at some point in the future).

      To disable the warning, clients have to grant native permissions to a selected list of modules, using the --enable-native-access command line flag.

      When working with an executable jars, it is sometimes necessary to specify, via custom manifest attributes, some options that are necessary for the application to work correctly. For instance, the "Add-Opens" attribute can be used to open a package for reflective access.

      It would be useful if some support would also be provided for "--enable-native-access" in the form of an attribute Enable-Native-Access=true/false, which if set is equivalent to passing "--enable-native-access=ALL-UNNAMED" to the Java launcher.

      Note that, since executable jars are only supported in classpath mode, it is not necessary to add a more complex manifest attribute which allows developers to explicitly list module names.

            jvernee Jorn Vernee
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: