RFR: 8331671: Implement JEP 472: Prepare to Restrict the Use of JNI [v7]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri May 17 13:23:06 UTC 2024


On Thu, 16 May 2024 18:39:57 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add note on --illegal-native-access default value in the launcher help
>
> src/java.base/share/classes/java/lang/System.java line 2023:
> 
>> 2021:      * @throws     NullPointerException if {@code filename} is {@code null}
>> 2022:      * @throws     IllegalCallerException If the caller is in a module that
>> 2023:      *             does not have native access enabled.
> 
> The exception description is fine, just noticed the other exception descriptions start with a lowercase "if", this one is different.

I'll fix this. Note that in `ModuleLayer.Controller`, all `@throws` start with capital letter, which is probably where I copied/pasted this from. I'll fix all, except for `ModuleLayer` where, for consistency, I think upper case is better.

> src/java.base/share/man/java.1 line 587:
> 
>> 585: \f[V]deny\f[R]: This mode disables all illegal native access except for
>> 586: those modules enabled by the \f[V]--enable-native-access\f[R]
>> 587: command-line option.
> 
> "This mode disable all illegal native access except for those modules enabled the --enable-native-access command-line option". 
> 
> This can be read to mean that modules granted native access with the command line option is also illegal native access An alternative is to make the second part of the sentence a new sentence, something like "Only modules enabled by the --enable-native-access command line option may perform native access.

I've simplified the text to:


This mode disables illegal native access. That is, any illegal native access causes an `IllegalCallerException`.
This mode will become the default in a future release.


I think it's not necessary to state again the dependency on `--enable-native-access` as we already defined what "illegal native access" means.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19213#discussion_r1604994928
PR Review Comment: https://git.openjdk.org/jdk/pull/19213#discussion_r1604993505


More information about the serviceability-dev mailing list