mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8346778: Enable native access should work with the source launcher
Reviewed-by: alanb
This commit is contained in:
parent
cbb2b847e4
commit
fec769b0a8
6 changed files with 82 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -834,9 +834,15 @@ public final class ModuleBootstrap {
|
|||
/**
|
||||
* Grants native access to modules selected using the --enable-native-access
|
||||
* command line option, and also to JDK modules that need the access.
|
||||
* <p>
|
||||
* In case of being in "source" launcher mode, warnings about unknown modules are
|
||||
* deferred to the source launcher logic in the jdk.compiler module, as those
|
||||
* modules might be not compiled, yet.
|
||||
*/
|
||||
private static void addEnableNativeAccess(ModuleLayer layer) {
|
||||
addEnableNativeAccess(layer, USER_NATIVE_ACCESS_MODULES, true);
|
||||
String launcherMode = getAndRemoveProperty("sun.java.launcher.mode");
|
||||
boolean shouldWarn = !"source".equals(launcherMode);
|
||||
addEnableNativeAccess(layer, USER_NATIVE_ACCESS_MODULES, shouldWarn);
|
||||
addEnableNativeAccess(layer, JDK_NATIVE_ACCESS_MODULES, false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue