[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:07:31 UTC 2023


On Tue, 27 Jun 2023 10:39:09 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.
>
> test/jdk/java/foreign/enablenativeaccess/TestEnableNativeAccessJarManifest.java line 92:
> 
>> 90:     @Test
>> 91:     public void testSucceed() throws Exception {
>> 92:         run("panama_no_unnamed_module_native_access", UNNAMED, successWithWarning("ALL-UNNAMED"), new String[]{});
> 
> Maybe using a record to capture attribute name/value would avoid the need to split the string?
> Also, other tests use a data provider, should we do that here too?

Yeah, I loosely based this test on `test\jdk\tools\launcher\modules\addexports\manifest\AddExportsAndOpensInManifest.java`, which uses this string splitting style. Using a record seems better.

I'll use a DataProvider as well (current code was based on `TestEnableNativeAccess::testRepeatedOption`, which doesn't use one either).

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

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


More information about the panama-dev mailing list