On Wed, 8 Jan 2025 20:29:03 GMT, Christian Stein <cst...@openjdk.org> wrote:

>> Please review this change request enabling native access in source launch 
>> mode when using a modular setup.
>> 
>> The change comes in two parts:
>> 1. Prevent warnings of unknown modules being emitted from module bootstrap 
>> for user module not being present in the boot layer: `java.c` and 
>> `ModuleBootstrap.java`
>> 2. Enable native access in source module(s) and also user modules on the 
>> module path as requested by `--enable-native-access` via the 
>> `ModuleLayer.Controller` API - and emit warning for unknown modules: 
>> `MemoryContext.java`
>> 
>> _Testing of tier1..3 is in progress..._
>
> Christian Stein has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Ignore already handled `ALL-UNNAMED` name

Submit improvements as suggested.

src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line 838:

> 836:      * command line option, and also to JDK modules that need the access.
> 837:      * <p>
> 838:      * In case of being in "source" launchmode, warnings about unknown 
> modules are

Suggestion:

     * In case of being in "source" launcher mode, warnings about unknown 
modules are

src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java line 844:

> 842:     private static void addEnableNativeAccess(ModuleLayer layer) {
> 843:         String launchMode = 
> getAndRemoveProperty("jdk.internal.java.launchmode");
> 844:         boolean shouldWarn = !"source".equals(launchMode);

Suggestion:

        String launcherMode = getAndRemoveProperty("sun.java.launcher.mode");
        boolean shouldWarn = !"source".equals(launcherMode);

src/java.base/share/native/libjli/java.c line 1376:

> 1374:     if (mode == LM_SOURCE) {
> 1375:         // signal module bootstrap to defer warnings about unknown 
> modules
> 1376:         AddOption("-Djdk.internal.java.launchmode=source", NULL);

Suggestion:

        // communicate the launcher mode to runtime
        AddOption("-Dsun.java.launcher.mode=source", NULL);

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

PR Review: https://git.openjdk.org/jdk/pull/22930#pullrequestreview-2546345699
PR Review Comment: https://git.openjdk.org/jdk/pull/22930#discussion_r1913035292
PR Review Comment: https://git.openjdk.org/jdk/pull/22930#discussion_r1913038153
PR Review Comment: https://git.openjdk.org/jdk/pull/22930#discussion_r1913037463

Reply via email to