RFR: 8268725: jshell does not support the --enable-native-access option [v2]

Jan Lahoda jlahoda at openjdk.java.net
Thu Sep 2 14:24:10 UTC 2021


On Thu, 2 Sep 2021 13:44:26 GMT, Rémi Forax <forax at openjdk.org> wrote:

> I don't like the fact that --enable-native-access will behave differently with java and jshell,
> in fact, it's worst, for jshell, --enable-native-access and -R--enable-native-access will behave differently.
> 
> For me, either "--enable-native-access" is a valid syntax and in case both java and jshell should support it,
> or the shortcut to use the unnamed module does not worth the cost and in that case, it should not be implemented.

I was struggling with that a bit also. But, in general, I don't think JShell says/advertises the snippets run in an unnamed module. So, requiring this knowledge from the user does not seem right, and would not be a big help over the currently working `-R--enable-preview=ALL-UNNAMED`. Also, the (existing) `--add-exports` option in JShell also does not accept the target module, only the source module and package. And `--enable-preview` also works slightly differently in runtime/JShell and at compile time. So there are already differences between options, and while it is not particularly nice to have another difference, it does not seem so bad to me.

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

PR: https://git.openjdk.java.net/jdk/pull/4810


More information about the kulla-dev mailing list