[foreign-memaccess+abi] RFR: 8310659: The jar tool should support allowing access to restricted methods from executable jars
Jorn Vernee
jvernee at openjdk.org
Tue Jun 27 13:04:30 UTC 2023
On Tue, 27 Jun 2023 10:33:24 GMT, Maurizio Cimadamore <mcimadamore 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));
Ah, can do. I thought that it would throw an exception if the input wasn't `true` or `false`, just like e.g. [`Integer::parseInt`](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Integer.html#parseInt(java.lang.String)) but it looks like it does essentially the same is I did, but also ignoring case. TIL.
-------------
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/843#discussion_r1243696133
More information about the panama-dev
mailing list