[foreign-memaccess+abi] RFR: 8310659: The jar tool should support allowing access to restricted methods from executable jars

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jun 27 10:36:32 UTC 2023


On Mon, 26 Jun 2023 16:44:01 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Add `Enable-Native-Access` jar attribute. `Enable-Native-Access: true` is equal to passing `--enable-native-access=ALL-UNNAMED` on the command line when running an executable jar (using `-jar <jar file>`).
> 
> Question: right now I've implemented this to check if the attribute value is exactly `true`, otherwise it is ignored. Should we only allow `true` or `false`, and throw an error on other values?
> 
> Reviewer note: I've factored some of a test code for analyzing output to `TestEnableNativeAccessBase` for the enable native access tests.

src/java.base/share/classes/sun/launcher/LauncherHelper.java line 601:

> 599:             }
> 600:             String enablesNativeAccess = mainAttrs.getValue(ENABLE_NATIVE_ACCESS);
> 601:             if ("true".equals(enablesNativeAccess)) {

What I see done elsewhere is something like this:

isMultiRelease = Boolean.parseBoolean(
                            attr.getValue(Attributes.Name.MULTI_RELEASE));

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/843#discussion_r1243521490


More information about the panama-dev mailing list