8136930: Simplify use of module-system options by custom launchers
Reviewed-by: alanb, ksrini, henryjen, sundar
This commit is contained in:
parent
5212065235
commit
e2a0ff3e0d
jdk
make
GenerateModuleSummary.gmkModuleTools.gmkTools.gmk
gendata
launcher
Launcher-java.desktop.gmkLauncher-java.scripting.gmkLauncher-jdk.compiler.gmkLauncher-jdk.javadoc.gmkLauncher-jdk.jlink.gmkLauncher-jdk.scripting.nashorn.shell.gmk
src/classes/build/tools/jigsaw
src
java.base/share
classes
java/lang
jdk/internal/module
sun/launcher
native/libjli
jdk.jartool/share/classes/sun/tools/jar
jdk.jlink/share/classes/jdk/tools
jimage
jlink
jmod
test
ProblemList.txtTEST.ROOT
com/sun
corba
5036554
7130985
se/impl
jdi
jndi/cosnaming
management/HotSpotDiagnosticMXBean
java
awt
Gtk/GtkVersionTest
Toolkit/Headless/WrappedToolkitTest
xembed/server
beans/XMLDecoder/8028054
lang
Class
forName/modules
getDeclaredField
getResource
ClassLoader/getResource/modules
SecurityManager/modules
String/concat
instrument
invoke/modules
reflect
net
Authenticator
SocketOption
httpclient/http2
nio/channels
DatagramChannel
ServerSocketChannel
SocketChannel
spi/SelectorProvider/inheritedChannel
rmi
activation
Activatable/extLoadedImpl
ActivationGroup/downloadActivationGroup
ActivationSystem/stubClassesPermitted
rmidViaInheritedChannel
module
registry/readTest
transport
security
util
Calendar
Formatter
Locale
PluggableLocale
ResourceBundle
ServiceLoader/modules
logging/modules
javax/crypto/Cipher
@ -42,6 +42,6 @@ $(GENGRAPHS_DIR)/technology-summary.html: $(TOOLS_MODULE_SRCDIR)/technology-summ
|
||||
|
||||
$(GENGRAPHS_DIR)/module-summary.html: $(BUILD_JIGSAW_TOOLS) $(GENGRAPHS_DIR)/technology-summary.html
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_MODULESUMMARY) -o $@ -mp $(IMAGES_OUTPUTDIR)/jmods
|
||||
$(TOOL_MODULESUMMARY) -o $@ --module-path $(IMAGES_OUTPUTDIR)/jmods
|
||||
|
||||
all: $(GENGRAPHS_DIR)/jdk.dot $(GENGRAPHS_DIR)/module-summary.html
|
||||
|
@ -36,12 +36,12 @@ $(eval $(call SetupJavaCompilation,BUILD_JIGSAW_TOOLS, \
|
||||
INCLUDES := build/tools/deps \
|
||||
build/tools/jigsaw, \
|
||||
BIN := $(TOOLS_CLASSES_DIR), \
|
||||
ADD_JAVAC_FLAGS := -XaddExports:jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED ))
|
||||
ADD_JAVAC_FLAGS := --add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED ))
|
||||
|
||||
|
||||
TOOL_GENGRAPHS := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \
|
||||
build.tools.jigsaw.GenGraphs
|
||||
|
||||
TOOL_MODULESUMMARY := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \
|
||||
-XaddExports:jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \
|
||||
--add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \
|
||||
build.tools.jigsaw.ModuleSummary
|
||||
|
@ -38,7 +38,7 @@ BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \
|
||||
################################################################################
|
||||
|
||||
ifeq ($(BOOT_JDK_MODULAR), true)
|
||||
COMPILEFONTCONFIG_ADD_EXPORTS := -XaddExports:java.desktop/sun.awt=ALL-UNNAMED
|
||||
COMPILEFONTCONFIG_ADD_EXPORTS := --add-exports java.desktop/sun.awt=ALL-UNNAMED
|
||||
endif
|
||||
|
||||
TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
@ -94,7 +94,7 @@ TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.too
|
||||
# Nimbus is used somewhere in the swing build.
|
||||
|
||||
ifeq ($(BOOT_JDK_MODULAR), true)
|
||||
COMPILENIMBUS_ADD_MODS := -addmods java.xml.bind
|
||||
COMPILENIMBUS_ADD_MODS := --add-modules java.xml.bind
|
||||
endif
|
||||
|
||||
TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
|
||||
|
@ -63,11 +63,11 @@ $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_LD, \
|
||||
|
||||
ifeq ($(BOOT_JDK_MODULAR), true)
|
||||
BREAK_ITERATOR_BOOTCLASSPATH := \
|
||||
-Xpatch:java.base=$(BREAK_ITERATOR_CLASSES)/java.base \
|
||||
-Xpatch:jdk.localedata=$(BREAK_ITERATOR_CLASSES)/jdk.localedata \
|
||||
-XaddExports:java.base/sun.text=ALL-UNNAMED \
|
||||
-XaddExports:java.base/sun.text.resources=ALL-UNNAMED \
|
||||
-XaddExports:jdk.localedata/sun.text.resources.ext=ALL-UNNAMED \
|
||||
--patch-module java.base=$(BREAK_ITERATOR_CLASSES)/java.base \
|
||||
--patch-module jdk.localedata=$(BREAK_ITERATOR_CLASSES)/jdk.localedata \
|
||||
--add-exports java.base/sun.text=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.text.resources=ALL-UNNAMED \
|
||||
--add-exports jdk.localedata/sun.text.resources.ext=ALL-UNNAMED \
|
||||
#
|
||||
else
|
||||
BREAK_ITERATOR_BOOTCLASSPATH := -Xbootclasspath/p:$(call PathList, \
|
||||
|
@ -31,7 +31,7 @@ $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk))
|
||||
ifndef BUILD_HEADLESS_ONLY
|
||||
$(eval $(call SetupBuildLauncher, appletviewer, \
|
||||
MAIN_CLASS := sun.applet.Main, \
|
||||
JAVA_ARGS := -addmods ALL-DEFAULT, \
|
||||
JAVA_ARGS := --add-modules ALL-DEFAULT, \
|
||||
LIBS_unix := $(X_LIBS), \
|
||||
))
|
||||
endif
|
||||
|
@ -27,5 +27,5 @@ include LauncherCommon.gmk
|
||||
|
||||
$(eval $(call SetupBuildLauncher, jrunscript, \
|
||||
MAIN_CLASS := com.sun.tools.script.shell.Main, \
|
||||
JAVA_ARGS := -addmods ALL-DEFAULT, \
|
||||
JAVA_ARGS := --add-modules ALL-DEFAULT, \
|
||||
))
|
||||
|
@ -27,7 +27,7 @@ include LauncherCommon.gmk
|
||||
|
||||
$(eval $(call SetupBuildLauncher, javac, \
|
||||
MAIN_CLASS := com.sun.tools.javac.Main, \
|
||||
JAVA_ARGS := -addmods ALL-DEFAULT, \
|
||||
JAVA_ARGS := --add-modules ALL-DEFAULT, \
|
||||
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
|
||||
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
|
||||
))
|
||||
|
@ -27,7 +27,7 @@ include LauncherCommon.gmk
|
||||
|
||||
$(eval $(call SetupBuildLauncher, javadoc, \
|
||||
MAIN_CLASS := jdk.javadoc.internal.tool.Main, \
|
||||
JAVA_ARGS := -addmods ALL-DEFAULT, \
|
||||
JAVA_ARGS := --add-modules ALL-DEFAULT, \
|
||||
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \
|
||||
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
|
||||
))
|
||||
|
@ -32,7 +32,7 @@ $(eval $(call SetupBuildLauncher, jimage,\
|
||||
|
||||
$(eval $(call SetupBuildLauncher, jlink,\
|
||||
MAIN_CLASS := jdk.tools.jlink.internal.Main, \
|
||||
JAVA_ARGS := -addmods ALL-DEFAULT, \
|
||||
JAVA_ARGS := --add-modules ALL-DEFAULT, \
|
||||
CFLAGS := -DENABLE_ARG_FILES \
|
||||
-DEXPAND_CLASSPATH_WILDCARDS \
|
||||
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \
|
||||
|
@ -27,6 +27,6 @@ include LauncherCommon.gmk
|
||||
|
||||
$(eval $(call SetupBuildLauncher, jjs, \
|
||||
MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \
|
||||
JAVA_ARGS := -addmods ALL-DEFAULT, \
|
||||
JAVA_ARGS := --add-modules ALL-DEFAULT, \
|
||||
CFLAGS := -DENABLE_ARG_FILES, \
|
||||
))
|
||||
|
@ -51,7 +51,7 @@ import static build.tools.jigsaw.ModuleSummary.HtmlDocument.Selector.*;
|
||||
import static build.tools.jigsaw.ModuleSummary.HtmlDocument.Division.*;
|
||||
|
||||
public class ModuleSummary {
|
||||
private static final String USAGE = "Usage: ModuleSummary -mp <dir> -o <outfile> [-root mn]*";
|
||||
private static final String USAGE = "Usage: ModuleSummary --module-path <dir> -o <outfile> [--root mn]*";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
int i=0;
|
||||
@ -61,13 +61,13 @@ public class ModuleSummary {
|
||||
while (i < args.length && args[i].startsWith("-")) {
|
||||
String arg = args[i++];
|
||||
switch (arg) {
|
||||
case "-mp":
|
||||
case "--module-path":
|
||||
modpath = Paths.get(args[i++]);
|
||||
break;
|
||||
case "-o":
|
||||
outfile = Paths.get(args[i++]);
|
||||
break;
|
||||
case "-root":
|
||||
case "--root":
|
||||
roots.add(args[i++]);
|
||||
default:
|
||||
System.err.println(USAGE);
|
||||
|
@ -644,23 +644,20 @@ public final class System {
|
||||
* <code>getProperties</code> operation, it may choose to permit the
|
||||
* {@link #getProperty(String)} operation.
|
||||
*
|
||||
* @implNote In addition to the standard system properties, the {@code
|
||||
* java} launcher may create the Java Virtual Machine with system
|
||||
* properties that have the following keys:
|
||||
* @implNote In addition to the standard system properties, the system
|
||||
* properties may include the following keys:
|
||||
* <table summary="Shows property keys and associated values">
|
||||
* <tr><th>Key</th>
|
||||
* <th>Description of Associated Value</th></tr>
|
||||
* <tr><td>{@code jdk.module.path}</td>
|
||||
* <td>Application module path</td></tr>
|
||||
* <tr><td>{@code jdk.upgrade.module.path}</td>
|
||||
* <td>The application module path</td></tr>
|
||||
* <tr><td>{@code jdk.module.upgrade.path}</td>
|
||||
* <td>The upgrade module path</td></tr>
|
||||
* <tr><td>{@code jdk.module.main}</td>
|
||||
* <td>The module name of the initial/main module</td></tr>
|
||||
* <tr><td>{@code jdk.module.main.class}</td>
|
||||
* <td>The main class name of the initial module</td></tr>
|
||||
* </table>
|
||||
* These properties may also be set by custom launchers that use the JNI
|
||||
* invocation API to create the Java Virtual Machine.
|
||||
*
|
||||
* @return the system properties
|
||||
* @exception SecurityException if a security manager exists and its
|
||||
|
@ -169,7 +169,7 @@ public final class ModuleReference {
|
||||
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this module has been patched via -Xpatch.
|
||||
* Returns {@code true} if this module has been patched via --patch-module.
|
||||
*/
|
||||
boolean isPatched() {
|
||||
return patched;
|
||||
|
@ -68,7 +68,7 @@ class ModuleReferences {
|
||||
|
||||
/**
|
||||
* Creates a ModuleReference to a module or to patched module when
|
||||
* creating modules for the boot Layer and -Xpatch is specified.
|
||||
* creating modules for the boot Layer and --patch-module is specified.
|
||||
*/
|
||||
private static ModuleReference newModule(ModuleDescriptor md,
|
||||
URI uri,
|
||||
|
@ -178,7 +178,7 @@ class SystemModuleFinder implements ModuleFinder {
|
||||
ModuleReference mref =
|
||||
new ModuleReference(md, uri, readerSupplier, hash);
|
||||
|
||||
// may need a reference to a patched module if -Xpatch specified
|
||||
// may need a reference to a patched module if --patch-module specified
|
||||
mref = ModulePatcher.interposeIfNeeded(mref);
|
||||
|
||||
return mref;
|
||||
|
@ -56,8 +56,8 @@ import jdk.internal.perf.PerfCounter;
|
||||
* The {@link #boot() boot} method is called early in the startup to initialize
|
||||
* the module system. In summary, the boot method creates a Configuration by
|
||||
* resolving a set of module names specified via the launcher (or equivalent)
|
||||
* -m and -addmods options. The modules are located on a module path that is
|
||||
* constructed from the upgrade module path, system modules, and application
|
||||
* -m and --add-modules options. The modules are located on a module path that
|
||||
* is constructed from the upgrade module path, system modules, and application
|
||||
* module path. The Configuration is instantiated as the boot Layer with each
|
||||
* module in the the configuration defined to one of the built-in class loaders.
|
||||
*/
|
||||
@ -127,16 +127,16 @@ public final class ModuleBootstrap {
|
||||
|
||||
long t2 = System.nanoTime();
|
||||
|
||||
// -upgrademodulepath option specified to launcher
|
||||
// --upgrade-module-path option specified to launcher
|
||||
ModuleFinder upgradeModulePath
|
||||
= createModulePathFinder("jdk.upgrade.module.path");
|
||||
= createModulePathFinder("jdk.module.upgrade.path");
|
||||
if (upgradeModulePath != null)
|
||||
systemModules = ModuleFinder.compose(upgradeModulePath, systemModules);
|
||||
|
||||
// -modulepath option specified to the launcher
|
||||
// --module-path option specified to the launcher
|
||||
ModuleFinder appModulePath = createModulePathFinder("jdk.module.path");
|
||||
|
||||
// The module finder: [-upgrademodulepath] system [-modulepath]
|
||||
// The module finder: [--upgrade-module-path] system [--module-path]
|
||||
ModuleFinder finder = systemModules;
|
||||
if (appModulePath != null)
|
||||
finder = ModuleFinder.compose(finder, appModulePath);
|
||||
@ -149,11 +149,11 @@ public final class ModuleBootstrap {
|
||||
if (mainModule != null)
|
||||
roots.add(mainModule);
|
||||
|
||||
// additional module(s) specified by -addmods
|
||||
// additional module(s) specified by --add-modules
|
||||
boolean addAllDefaultModules = false;
|
||||
boolean addAllSystemModules = false;
|
||||
boolean addAllApplicationModules = false;
|
||||
String propValue = System.getProperty("jdk.launcher.addmods");
|
||||
String propValue = getAndRemoveProperty("jdk.module.addmods");
|
||||
if (propValue != null) {
|
||||
for (String mod: propValue.split(",")) {
|
||||
switch (mod) {
|
||||
@ -172,8 +172,8 @@ public final class ModuleBootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
// -limitmods
|
||||
propValue = System.getProperty("jdk.launcher.limitmods");
|
||||
// --limit-modules
|
||||
propValue = getAndRemoveProperty("jdk.module.limitmods");
|
||||
if (propValue != null) {
|
||||
Set<String> mods = new HashSet<>();
|
||||
for (String mod: propValue.split(",")) {
|
||||
@ -216,7 +216,7 @@ public final class ModuleBootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
// If `-addmods ALL-SYSTEM` is specified then all observable system
|
||||
// If `--add-modules ALL-SYSTEM` is specified then all observable system
|
||||
// modules will be resolved.
|
||||
if (addAllSystemModules) {
|
||||
ModuleFinder f = finder; // observable modules
|
||||
@ -228,9 +228,9 @@ public final class ModuleBootstrap {
|
||||
.forEach(mn -> roots.add(mn));
|
||||
}
|
||||
|
||||
// If `-addmods ALL-MODULE-PATH` is specified then all observable
|
||||
// If `--add-modules ALL-MODULE-PATH` is specified then all observable
|
||||
// modules on the application module path will be resolved.
|
||||
if (appModulePath != null && addAllApplicationModules) {
|
||||
if (appModulePath != null && addAllApplicationModules) {
|
||||
ModuleFinder f = finder; // observable modules
|
||||
appModulePath.findAll()
|
||||
.stream()
|
||||
@ -250,7 +250,7 @@ public final class ModuleBootstrap {
|
||||
if (baseUri.getScheme().equals("jrt") // toLowerCase not needed here
|
||||
&& (upgradeModulePath == null)
|
||||
&& (appModulePath == null)
|
||||
&& (System.getProperty("jdk.launcher.patch.0") == null)) {
|
||||
&& (!ModulePatcher.isBootLayerPatched())) {
|
||||
needPostResolutionChecks = false;
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ public final class ModuleBootstrap {
|
||||
PerfCounters.loadModulesTime.addElapsedTimeFrom(t5);
|
||||
|
||||
|
||||
// -XaddReads and -XaddExports
|
||||
// --add-reads and --add-exports
|
||||
addExtraReads(bootLayer);
|
||||
addExtraExports(bootLayer);
|
||||
|
||||
@ -394,13 +394,13 @@ public final class ModuleBootstrap {
|
||||
|
||||
|
||||
/**
|
||||
* Process the -XaddReads options to add any additional read edges that
|
||||
* Process the --add-reads options to add any additional read edges that
|
||||
* are specified on the command-line.
|
||||
*/
|
||||
private static void addExtraReads(Layer bootLayer) {
|
||||
|
||||
// decode the command line options
|
||||
Map<String, Set<String>> map = decode("jdk.launcher.addreads.");
|
||||
Map<String, Set<String>> map = decode("jdk.module.addreads.");
|
||||
|
||||
for (Map.Entry<String, Set<String>> e : map.entrySet()) {
|
||||
|
||||
@ -431,13 +431,13 @@ public final class ModuleBootstrap {
|
||||
|
||||
|
||||
/**
|
||||
* Process the -XaddExports options to add any additional read edges that
|
||||
* Process the --add-exports options to add any additional read edges that
|
||||
* are specified on the command-line.
|
||||
*/
|
||||
private static void addExtraExports(Layer bootLayer) {
|
||||
|
||||
// decode the command line options
|
||||
Map<String, Set<String>> map = decode("jdk.launcher.addexports.");
|
||||
Map<String, Set<String>> map = decode("jdk.module.addexports.");
|
||||
|
||||
for (Map.Entry<String, Set<String>> e : map.entrySet()) {
|
||||
|
||||
@ -483,13 +483,14 @@ public final class ModuleBootstrap {
|
||||
|
||||
|
||||
/**
|
||||
* Decodes the values of -XaddReads or -XaddExports options
|
||||
* Decodes the values of --add-reads or --add-exports options
|
||||
*
|
||||
* The format of the options is: $KEY=$MODULE(,$MODULE)*
|
||||
*/
|
||||
private static Map<String, Set<String>> decode(String prefix) {
|
||||
int index = 0;
|
||||
String value = System.getProperty(prefix + index);
|
||||
// the system property is removed after decoding
|
||||
String value = getAndRemoveProperty(prefix + index);
|
||||
if (value == null)
|
||||
return Collections.emptyMap();
|
||||
|
||||
@ -522,12 +523,18 @@ public final class ModuleBootstrap {
|
||||
}
|
||||
|
||||
index++;
|
||||
value = System.getProperty(prefix + index);
|
||||
value = getAndRemoveProperty(prefix + index);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and remove the named system property
|
||||
*/
|
||||
private static String getAndRemoveProperty(String key) {
|
||||
return (String)System.getProperties().remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws a RuntimeException with the given message
|
||||
|
@ -58,7 +58,7 @@ import sun.net.www.ParseUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Provides support for patching modules in the boot layer with -Xpatch.
|
||||
* Provides support for patching modules in the boot layer with --patch-module.
|
||||
*/
|
||||
|
||||
public final class ModulePatcher {
|
||||
@ -66,28 +66,27 @@ public final class ModulePatcher {
|
||||
private static final JavaLangModuleAccess JLMA
|
||||
= SharedSecrets.getJavaLangModuleAccess();
|
||||
|
||||
// the prefix of the system properties that encode the value of -Xpatch
|
||||
private static final String PATCH_PROPERTY_PREFIX = "jdk.launcher.patch.";
|
||||
// the prefix of the system properties that encode the value of --patch-module
|
||||
private static final String PATCH_PROPERTY_PREFIX = "jdk.module.patch.";
|
||||
|
||||
// module name -> sequence of patches (directories or JAR files)
|
||||
private static final Map<String, List<Path>> PATCH_MAP = decodeProperties();
|
||||
|
||||
private ModulePatcher() { }
|
||||
|
||||
|
||||
/**
|
||||
* Decodes the values of -Xpatch options, returning a Map of module name to
|
||||
* list of file paths.
|
||||
* Decodes the values of --patch-module options, returning a Map of module
|
||||
* name to list of file paths.
|
||||
*
|
||||
* @throws IllegalArgumentException if the the module name is missing or
|
||||
* -Xpatch is used more than once to patch the same module
|
||||
* --patch-module is used more than once to patch the same module
|
||||
*/
|
||||
private static Map<String, List<Path>> decodeProperties() {
|
||||
|
||||
int index = 0;
|
||||
String value = System.getProperty(PATCH_PROPERTY_PREFIX + index);
|
||||
String value = getAndRemoveProperty(PATCH_PROPERTY_PREFIX + index);
|
||||
if (value == null)
|
||||
return Collections.emptyMap(); // -Xpatch not specified
|
||||
return Collections.emptyMap(); // --patch-module not specified
|
||||
|
||||
Map<String, List<Path>> map = new HashMap<>();
|
||||
while (value != null) {
|
||||
@ -115,13 +114,21 @@ public final class ModulePatcher {
|
||||
}
|
||||
|
||||
index++;
|
||||
value = System.getProperty(PATCH_PROPERTY_PREFIX + index);
|
||||
value = getAndRemoveProperty(PATCH_PROPERTY_PREFIX + index);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns {@code true} is --patch-module is specified to patch modules
|
||||
* in the boot layer.
|
||||
*/
|
||||
static boolean isBootLayerPatched() {
|
||||
return !PATCH_MAP.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a module reference that interposes on the given module if
|
||||
* needed. If there are no patches for the given module then the module
|
||||
@ -536,6 +543,13 @@ public final class ModulePatcher {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and remove the named system property
|
||||
*/
|
||||
private static String getAndRemoveProperty(String key) {
|
||||
return (String)System.getProperties().remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Derives a package name from the name of an entry in a JAR file.
|
||||
*/
|
||||
|
@ -60,8 +60,6 @@ import java.nio.charset.Charset;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.Normalizer;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ResourceBundle;
|
||||
@ -905,7 +903,7 @@ public final class LauncherHelper {
|
||||
|
||||
ModuleFinder finder = jdk.internal.module.ModuleBootstrap.finder();
|
||||
|
||||
int colon = optionFlag.indexOf(':');
|
||||
int colon = optionFlag.indexOf('=');
|
||||
if (colon == -1) {
|
||||
finder.findAll().stream()
|
||||
.sorted(Comparator.comparing(ModuleReference::descriptor))
|
||||
|
@ -27,7 +27,7 @@
|
||||
java.launcher.opt.header = Usage: {0} [options] class [args...]\n\
|
||||
\ (to execute a class)\n or {0} [options] -jar jarfile [args...]\n\
|
||||
\ (to execute a jar file)\n\
|
||||
\ or {0} [options] -mp <modulepath> -m <modulename>[/<mainclass>] [args...]\n\
|
||||
\ or {0} [options] -p <modulepath> -m <modulename>[/<mainclass>] [args...]\n\
|
||||
\ (to execute the main class in a module)\n\
|
||||
where options include:\n
|
||||
|
||||
@ -41,24 +41,28 @@ java.launcher.ergo.message2 =\ because you are running on a se
|
||||
# Translators please note do not translate the options themselves
|
||||
java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\
|
||||
\ -classpath <class search path of directories and zip/jar files>\n\
|
||||
\ --class-path <class search path of directories and zip/jar files>\n\
|
||||
\ A {0} separated list of directories, JAR archives,\n\
|
||||
\ and ZIP archives to search for class files.\n\
|
||||
\ -mp <module path>\n\
|
||||
\ -modulepath <module path>...\n\
|
||||
\ -p <module path>\n\
|
||||
\ --module-path <module path>...\n\
|
||||
\ A {0} separated list of directories, each directory\n\
|
||||
\ is a directory of modules.\n\
|
||||
\ -upgrademodulepath <module path>...\n\
|
||||
\ --upgrade-module-path <module path>...\n\
|
||||
\ A {0} separated list of directories, each directory\n\
|
||||
\ is a directory of modules that replace upgradeable\n\
|
||||
\ modules in the runtime image\n\
|
||||
\ -m <modulename>[/<mainclass>]\n\
|
||||
\ -m <module>[/<mainclass>]\n\
|
||||
\ --module <modulename>[/<mainclass>]\n\
|
||||
\ the initial module to resolve, and the name of the main class\n\
|
||||
\ to execute if not specified by the module\n\
|
||||
\ -addmods <modulename>[,<modulename>...]\n\
|
||||
\ root modules to resolve in addition to the initial module\n\
|
||||
\ -limitmods <modulename>[,<modulename>...]\n\
|
||||
\ --add-modules <modulename>[,<modulename>...]\n\
|
||||
\ root modules to resolve in addition to the initial module.\n\
|
||||
\ <modulename> can also be ALL-DEFAULT, ALL-SYSTEM,\n\
|
||||
\ ALL-MODULE-PATH.\n\
|
||||
\ --limit-modules <modulename>[,<modulename>...]\n\
|
||||
\ limit the universe of observable modules\n\
|
||||
\ -listmods[:<modulename>[,<modulename>...]]\n\
|
||||
\ --list-modules [<modulename>[,<modulename>...]]\n\
|
||||
\ list the observable modules and exit\n\
|
||||
\ --dry-run create VM but do not execute main method.\n\
|
||||
\ This --dry-run option may be useful for validating the\n\
|
||||
@ -69,7 +73,8 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
|
||||
\ enable verbose output\n\
|
||||
\ -version print product version and exit\n\
|
||||
\ -showversion print product version and continue\n\
|
||||
\ -? -help print this help message\n\
|
||||
\ -? -help --help\n\
|
||||
\ print this help message\n\
|
||||
\ -X print help on non-standard options\n\
|
||||
\ -ea[:<packagename>...|:<classname>]\n\
|
||||
\ -enableassertions[:<packagename>...|:<classname>]\n\
|
||||
@ -91,6 +96,8 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
|
||||
\ -splash:<imagepath>\n\
|
||||
\ show splash screen with specified image\n\
|
||||
\ @<filepath> read options from the specified file\n\
|
||||
\To specify an argument for a long option, you can use --<name>=<value> or\n\
|
||||
\--<name> <value>.\n\
|
||||
|
||||
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
|
||||
|
||||
@ -123,17 +130,21 @@ java.launcher.X.usage=\
|
||||
\ show all property settings and continue\n\
|
||||
\ -XshowSettings:locale\n\
|
||||
\ show all locale related settings and continue\n\
|
||||
\ -XaddReads:<module>=<other-module>(,<other-module>)*\n\
|
||||
\ <module> reads other modules,\n\
|
||||
\ regardless of module declaration\n\
|
||||
\ -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n\
|
||||
\ <module> exports <package> to other modules,\n\
|
||||
\ regardless of module declaration\n\
|
||||
\ -Xpatch:<module>=<file>({0}<file>)*\n\
|
||||
\ -Xdisable-@files disable further argument file expansion\n\
|
||||
\ --add-reads <module>=<target-module>(,<target-module>)*\n\
|
||||
\ updates <module> to read <target-module>, regardless\n\
|
||||
\ of module declaration. \n\
|
||||
\ <target-module> can be ALL-UNNAMED to read all unnamed\n\
|
||||
\ modules.\n\
|
||||
\ --add-exports <module>/<package>=<target-module>(,<target-module>)*\n\
|
||||
\ updates <module> to export <package> to <target-module>,\n\
|
||||
\ regardless of module declaration.\n\
|
||||
\ <target-module> can be ALL-UNNAMED to export to all\n\
|
||||
\ unnamed modules.\n\
|
||||
\ --patch-module <module>=<file>({0}<file>)*\n\
|
||||
\ Override or augment a module with classes and resources\n\
|
||||
\ in JAR files or directories\n\
|
||||
\ -Xdisable-@files disable further argument file expansion\n\n\
|
||||
The -X options are non-standard and subject to change without notice.\n
|
||||
\ in JAR files or directories.\n\n\
|
||||
These options are non-standard and subject to change without notice.\n
|
||||
|
||||
# Translators please note do not translate the options themselves
|
||||
java.launcher.X.macosx.usage=\
|
||||
|
@ -102,24 +102,21 @@ static void checkArg(const char *arg) {
|
||||
|
||||
// All arguments arrive here must be a launcher argument,
|
||||
// ie. by now, all argfile expansions must have been performed.
|
||||
if (*arg++ == '-') {
|
||||
if (*arg == '-') {
|
||||
expectingNoDashArg = JNI_FALSE;
|
||||
if (JLI_StrCmp(arg, "cp") == 0 ||
|
||||
JLI_StrCmp(arg, "classpath") == 0 ||
|
||||
JLI_StrCmp(arg, "addmods") == 0 ||
|
||||
JLI_StrCmp(arg, "limitmods") == 0 ||
|
||||
JLI_StrCmp(arg, "mp") == 0 ||
|
||||
JLI_StrCmp(arg, "modulepath") == 0 ||
|
||||
JLI_StrCmp(arg, "upgrademodulepath") == 0) {
|
||||
if (IsWhiteSpaceOption(arg)) {
|
||||
// expect an argument
|
||||
expectingNoDashArg = JNI_TRUE;
|
||||
} else if (JLI_StrCmp(arg, "jar") == 0 ||
|
||||
JLI_StrCmp(arg, "m") == 0) {
|
||||
// This is tricky, we do expect NoDashArg
|
||||
// But that is considered main class to stop expansion
|
||||
expectingNoDashArg = JNI_FALSE;
|
||||
// We can not just update the idx here because if -jar @file
|
||||
// still need expansion of @file to get the argument for -jar
|
||||
} else if (JLI_StrCmp(arg, "Xdisable-@files") == 0) {
|
||||
|
||||
if (JLI_StrCmp(arg, "-jar") == 0 ||
|
||||
JLI_StrCmp(arg, "-m") == 0) {
|
||||
// This is tricky, we do expect NoDashArg
|
||||
// But that is considered main class to stop expansion
|
||||
expectingNoDashArg = JNI_FALSE;
|
||||
// We can not just update the idx here because if -jar @file
|
||||
// still need expansion of @file to get the argument for -jar
|
||||
}
|
||||
} else if (JLI_StrCmp(arg, "-Xdisable-@files") == 0) {
|
||||
stopExpansion = JNI_TRUE;
|
||||
}
|
||||
} else {
|
||||
|
@ -69,7 +69,7 @@ static jboolean showVersion = JNI_FALSE; /* print but continue */
|
||||
static jboolean printUsage = JNI_FALSE; /* print and exit*/
|
||||
static jboolean printXUsage = JNI_FALSE; /* print and exit*/
|
||||
static jboolean dryRun = JNI_FALSE; /* initialize VM and exit */
|
||||
static char *showSettings = NULL; /* print but continue */
|
||||
static char *showSettings = NULL; /* print but continue */
|
||||
static char *listModules = NULL;
|
||||
|
||||
static const char *_program_name;
|
||||
@ -99,17 +99,9 @@ static int numOptions, maxOptions;
|
||||
* Prototypes for functions internal to launcher.
|
||||
*/
|
||||
static void SetClassPath(const char *s);
|
||||
static void SetModulePath(const char *s);
|
||||
static void SetUpgradeModulePath(const char *s);
|
||||
static void SetMainModule(const char *s);
|
||||
static void SetAddModulesProp(const char *mods);
|
||||
static void SetLimitModulesProp(const char *mods);
|
||||
static void SetAddReadsProp(const jint n, const char *s);
|
||||
static void SetAddExportsProp(const jint n, const char *s);
|
||||
static void SetPatchProp(const jint n, const char *s);
|
||||
static void SelectVersion(int argc, char **argv, char **main_class);
|
||||
static void SetJvmEnvironment(int argc, char **argv);
|
||||
static jboolean IsWhiteSpaceOptionArgument(const char* name);
|
||||
static jboolean ParseArguments(int *pargc, char ***pargv,
|
||||
int *pmode, char **pwhat,
|
||||
int *pret, const char *jrepath);
|
||||
@ -133,6 +125,18 @@ static void SetPaths(int argc, char **argv);
|
||||
static void DumpState();
|
||||
static jboolean RemovableOption(char *option);
|
||||
|
||||
enum OptionKind {
|
||||
LAUNCHER_OPTION = 0,
|
||||
LAUNCHER_OPTION_WITH_ARGUMENT,
|
||||
LAUNCHER_MAIN_OPTION,
|
||||
VM_LONG_OPTION,
|
||||
VM_LONG_OPTION_WITH_ARGUMENT,
|
||||
VM_OPTION
|
||||
};
|
||||
|
||||
static int GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue);
|
||||
static jboolean IsOptionWithArgument(int argc, char **argv);
|
||||
|
||||
/* Maximum supported entries from jvm.cfg. */
|
||||
#define INIT_MAX_KNOWN_VMS 10
|
||||
|
||||
@ -162,6 +166,19 @@ static int KnownVMIndex(const char* name);
|
||||
static void FreeKnownVMs();
|
||||
static jboolean IsWildCardEnabled();
|
||||
|
||||
/*
|
||||
* This reports error. VM will not be created and no usage is printed.
|
||||
*/
|
||||
#define REPORT_ERROR(AC_ok, AC_failure_message, AC_questionable_arg) \
|
||||
do { \
|
||||
if (!AC_ok) { \
|
||||
JLI_ReportErrorMessage(AC_failure_message, AC_questionable_arg); \
|
||||
printUsage = JNI_FALSE; \
|
||||
*pret = 1; \
|
||||
return JNI_FALSE; \
|
||||
} \
|
||||
} while (JNI_FALSE)
|
||||
|
||||
#define ARG_CHECK(AC_arg_count, AC_failure_message, AC_questionable_arg) \
|
||||
do { \
|
||||
if (AC_arg_count < 1) { \
|
||||
@ -511,17 +528,73 @@ JavaMain(void * _args)
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if the given option name has a whitespace separated argument.
|
||||
* Test if the given name is one of the class path options.
|
||||
*/
|
||||
jboolean
|
||||
IsWhiteSpaceOptionArgument(const char* name) {
|
||||
static jboolean
|
||||
IsClassPathOption(const char* name) {
|
||||
return JLI_StrCmp(name, "-classpath") == 0 ||
|
||||
JLI_StrCmp(name, "-cp") == 0 ||
|
||||
JLI_StrCmp(name, "-modulepath") == 0 ||
|
||||
JLI_StrCmp(name, "-mp") == 0 ||
|
||||
JLI_StrCmp(name, "-upgrademodulepath") == 0 ||
|
||||
JLI_StrCmp(name, "-addmods") == 0 ||
|
||||
JLI_StrCmp(name, "-limitmods") == 0;
|
||||
JLI_StrCmp(name, "--class-path") == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if the given name is a launcher option taking the main entry point.
|
||||
*/
|
||||
static jboolean
|
||||
IsLauncherMainOption(const char* name) {
|
||||
return JLI_StrCmp(name, "--module") == 0 ||
|
||||
JLI_StrCmp(name, "-m") == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if the given name is a white-space launcher option.
|
||||
*/
|
||||
static jboolean
|
||||
IsLauncherOption(const char* name) {
|
||||
return IsClassPathOption(name) ||
|
||||
IsLauncherMainOption(name) ||
|
||||
JLI_StrCmp(name, "--list-modules") == 0;
|
||||
}
|
||||
|
||||
#ifndef OLD_MODULE_OPTIONS
|
||||
/*
|
||||
* Old module options for transition
|
||||
*/
|
||||
static jboolean
|
||||
IsOldModuleOption(const char* name) {
|
||||
return JLI_StrCmp(name, "-modulepath") == 0 ||
|
||||
JLI_StrCmp(name, "-mp") == 0 ||
|
||||
JLI_StrCmp(name, "-upgrademodulepath") == 0 ||
|
||||
JLI_StrCmp(name, "-addmods") == 0 ||
|
||||
JLI_StrCmp(name, "-limitmods") == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Test if the given name is a module-system white-space option that
|
||||
* will be passed to the VM with its corresponding long-form option
|
||||
* name and "=" delimiter.
|
||||
*/
|
||||
static jboolean
|
||||
IsModuleOption(const char* name) {
|
||||
return JLI_StrCmp(name, "--module-path") == 0 ||
|
||||
JLI_StrCmp(name, "-p") == 0 ||
|
||||
JLI_StrCmp(name, "--upgrade-module-path") == 0 ||
|
||||
JLI_StrCmp(name, "--add-modules") == 0 ||
|
||||
JLI_StrCmp(name, "--limit-modules") == 0 ||
|
||||
JLI_StrCmp(name, "--add-exports") == 0 ||
|
||||
JLI_StrCmp(name, "--add-reads") == 0 ||
|
||||
JLI_StrCmp(name, "--patch-module") == 0 ||
|
||||
IsOldModuleOption(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if the given name has a white space option.
|
||||
*/
|
||||
jboolean
|
||||
IsWhiteSpaceOption(const char* name) {
|
||||
return IsModuleOption(name) ||
|
||||
IsLauncherOption(name);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -559,7 +632,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (IsWhiteSpaceOptionArgument(arg)) {
|
||||
if (IsWhiteSpaceOption(arg)) {
|
||||
newArgv[newArgvIdx++] = arg;
|
||||
argi++;
|
||||
if (argi < argc) {
|
||||
@ -701,7 +774,7 @@ SetJvmEnvironment(int argc, char **argv) {
|
||||
if (i > 0) {
|
||||
char *prev = argv[i - 1];
|
||||
// skip non-dash arg preceded by class path specifiers
|
||||
if (*arg != '-' && IsWhiteSpaceOptionArgument(prev)) {
|
||||
if (*arg != '-' && IsWhiteSpaceOption(prev)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -709,6 +782,7 @@ SetJvmEnvironment(int argc, char **argv) {
|
||||
|| JLI_StrCmp(arg, "-version") == 0
|
||||
|| JLI_StrCmp(arg, "-fullversion") == 0
|
||||
|| JLI_StrCmp(arg, "-help") == 0
|
||||
|| JLI_StrCmp(arg, "--help") == 0
|
||||
|| JLI_StrCmp(arg, "-?") == 0
|
||||
|| JLI_StrCmp(arg, "-jar") == 0
|
||||
|| JLI_StrCmp(arg, "-X") == 0) {
|
||||
@ -882,39 +956,16 @@ SetClassPath(const char *s)
|
||||
}
|
||||
|
||||
static void
|
||||
SetModulePath(const char *s)
|
||||
AddLongFormOption(const char *option, const char *arg)
|
||||
{
|
||||
static const char format[] = "%s=%s";
|
||||
char *def;
|
||||
const char *orig = s;
|
||||
static const char format[] = "-Djdk.module.path=%s";
|
||||
if (s == NULL)
|
||||
return;
|
||||
s = JLI_WildcardExpandClasspath(s);
|
||||
def = JLI_MemAlloc(sizeof(format)
|
||||
- 2 /* strlen("%s") */
|
||||
+ JLI_StrLen(s));
|
||||
sprintf(def, format, s);
|
||||
AddOption(def, NULL);
|
||||
if (s != orig)
|
||||
JLI_MemFree((char *) s);
|
||||
}
|
||||
size_t def_len;
|
||||
|
||||
static void
|
||||
SetUpgradeModulePath(const char *s)
|
||||
{
|
||||
char *def;
|
||||
const char *orig = s;
|
||||
static const char format[] = "-Djdk.upgrade.module.path=%s";
|
||||
if (s == NULL)
|
||||
return;
|
||||
s = JLI_WildcardExpandClasspath(s);
|
||||
def = JLI_MemAlloc(sizeof(format)
|
||||
- 2 /* strlen("%s") */
|
||||
+ JLI_StrLen(s));
|
||||
sprintf(def, format, s);
|
||||
def_len = JLI_StrLen(option) + 1 + JLI_StrLen(arg) + 1;
|
||||
def = JLI_MemAlloc(def_len);
|
||||
JLI_Snprintf(def, def_len, format, option, arg);
|
||||
AddOption(def, NULL);
|
||||
if (s != orig)
|
||||
JLI_MemFree((char *) s);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -939,46 +990,6 @@ SetMainModule(const char *s)
|
||||
AddOption(def, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
SetAddModulesProp(const char *mods) {
|
||||
size_t buflen = JLI_StrLen(mods) + 40;
|
||||
char *prop = (char *)JLI_MemAlloc(buflen);
|
||||
JLI_Snprintf(prop, buflen, "-Djdk.launcher.addmods=%s", mods);
|
||||
AddOption(prop, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
SetLimitModulesProp(const char *mods) {
|
||||
size_t buflen = JLI_StrLen(mods) + 40;
|
||||
char *prop = (char *)JLI_MemAlloc(buflen);
|
||||
JLI_Snprintf(prop, buflen, "-Djdk.launcher.limitmods=%s", mods);
|
||||
AddOption(prop, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
SetAddReadsProp(const jint n, const char *s) {
|
||||
size_t buflen = JLI_StrLen(s) + 40;
|
||||
char *prop = (char *)JLI_MemAlloc(buflen);
|
||||
JLI_Snprintf(prop, buflen, "-Djdk.launcher.addreads.%d=%s", n, s);
|
||||
AddOption(prop, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
SetAddExportsProp(const jint n, const char *s) {
|
||||
size_t buflen = JLI_StrLen(s) + 40;
|
||||
char *prop = (char *)JLI_MemAlloc(buflen);
|
||||
JLI_Snprintf(prop, buflen, "-Djdk.launcher.addexports.%d=%s", n, s);
|
||||
AddOption(prop, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
SetPatchProp(const jint n, const char *s) {
|
||||
size_t buflen = JLI_StrLen(s) + 40;
|
||||
char *prop = (char *)JLI_MemAlloc(buflen);
|
||||
JLI_Snprintf(prop, buflen, "-Djdk.launcher.patch.%d=%s", n, s);
|
||||
AddOption(prop, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* The SelectVersion() routine ensures that an appropriate version of
|
||||
* the JRE is running. The specification for the appropriate version
|
||||
@ -1003,6 +1014,7 @@ SelectVersion(int argc, char **argv, char **main_class)
|
||||
char *splash_jar_name = NULL;
|
||||
char *env_in;
|
||||
int res;
|
||||
jboolean has_arg;
|
||||
|
||||
/*
|
||||
* If the version has already been selected, set *main_class
|
||||
@ -1033,9 +1045,11 @@ SelectVersion(int argc, char **argv, char **main_class)
|
||||
* This capability is no longer available with JRE versions 1.9 and later.
|
||||
* These command line options are reported as errors.
|
||||
*/
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
while ((arg = *argv) != 0 && *arg == '-') {
|
||||
has_arg = IsOptionWithArgument(argc, argv);
|
||||
if (JLI_StrCCmp(arg, "-version:") == 0) {
|
||||
JLI_ReportErrorMessage(SPC_ERROR1);
|
||||
} else if (JLI_StrCmp(arg, "-jre-restrict-search") == 0) {
|
||||
@ -1045,10 +1059,12 @@ SelectVersion(int argc, char **argv, char **main_class)
|
||||
} else {
|
||||
if (JLI_StrCmp(arg, "-jar") == 0)
|
||||
jarflag = 1;
|
||||
if (IsWhiteSpaceOptionArgument(arg) && (argc >= 2)) {
|
||||
argc--;
|
||||
argv++;
|
||||
arg = *argv;
|
||||
if (IsWhiteSpaceOption(arg)) {
|
||||
if (has_arg) {
|
||||
argc--;
|
||||
argv++;
|
||||
arg = *argv;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1139,6 +1155,108 @@ SelectVersion(int argc, char **argv, char **main_class)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Test if the current argv is an option, i.e. with a leading `-`
|
||||
* and followed with an argument without a leading `-`.
|
||||
*/
|
||||
static jboolean
|
||||
IsOptionWithArgument(int argc, char** argv) {
|
||||
char* option;
|
||||
char* arg;
|
||||
|
||||
if (argc <= 1)
|
||||
return JNI_FALSE;
|
||||
|
||||
option = *argv;
|
||||
arg = *(argv+1);
|
||||
return *option == '-' && *arg != '-';
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the option, and its argument if the option has an argument.
|
||||
* It will update *pargc, **pargv to the next option.
|
||||
*/
|
||||
static int
|
||||
GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue) {
|
||||
int argc = *pargc;
|
||||
char** argv = *pargv;
|
||||
char* arg = *argv;
|
||||
|
||||
char* option = arg;
|
||||
char* value = NULL;
|
||||
char* equals = NULL;
|
||||
int kind = LAUNCHER_OPTION;
|
||||
jboolean has_arg = JNI_FALSE;
|
||||
|
||||
// check if this option may be a white-space option with an argument
|
||||
has_arg = IsOptionWithArgument(argc, argv);
|
||||
|
||||
argv++; --argc;
|
||||
if (IsLauncherOption(arg)) {
|
||||
if (has_arg) {
|
||||
value = *argv;
|
||||
argv++; --argc;
|
||||
}
|
||||
kind = IsLauncherMainOption(arg) ? LAUNCHER_MAIN_OPTION
|
||||
: LAUNCHER_OPTION_WITH_ARGUMENT;
|
||||
} else if (IsModuleOption(arg)) {
|
||||
kind = VM_LONG_OPTION_WITH_ARGUMENT;
|
||||
if (has_arg) {
|
||||
value = *argv;
|
||||
argv++; --argc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Support short form alias
|
||||
*/
|
||||
if (JLI_StrCmp(arg, "-p") == 0) {
|
||||
option = "--module-path";
|
||||
}
|
||||
|
||||
} else if (JLI_StrCCmp(arg, "--") == 0 && (equals = JLI_StrChr(arg, '=')) != NULL) {
|
||||
value = equals+1;
|
||||
if (JLI_StrCCmp(arg, "--list-modules=") == 0 ||
|
||||
JLI_StrCCmp(arg, "--module=") == 0 ||
|
||||
JLI_StrCCmp(arg, "--class-path=") == 0) {
|
||||
kind = LAUNCHER_OPTION_WITH_ARGUMENT;
|
||||
} else {
|
||||
kind = VM_LONG_OPTION;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OLD_MODULE_OPTIONS
|
||||
// for transition to support both old and new syntax
|
||||
if (JLI_StrCmp(arg, "-modulepath") == 0 ||
|
||||
JLI_StrCmp(arg, "-mp") == 0) {
|
||||
option = "--module-path";
|
||||
} else if (JLI_StrCmp(arg, "-upgrademodulepath") == 0) {
|
||||
option = "--upgrade-module-path";
|
||||
} else if (JLI_StrCmp(arg, "-addmods") == 0) {
|
||||
option = "--add-modules";
|
||||
} else if (JLI_StrCmp(arg, "-limitmods") == 0) {
|
||||
option = "--limit-modules";
|
||||
} else if (JLI_StrCCmp(arg, "-XaddExports:") == 0) {
|
||||
option = "--add-exports";
|
||||
value = arg + 13;
|
||||
kind = VM_LONG_OPTION_WITH_ARGUMENT;
|
||||
} else if (JLI_StrCCmp(arg, "-XaddReads:") == 0) {
|
||||
option = "--add-reads";
|
||||
value = arg + 11;
|
||||
kind = VM_LONG_OPTION_WITH_ARGUMENT;
|
||||
} else if (JLI_StrCCmp(arg, "-Xpatch:") == 0) {
|
||||
option = "--patch-module";
|
||||
value = arg + 8;
|
||||
kind = VM_LONG_OPTION_WITH_ARGUMENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
*pargc = argc;
|
||||
*pargv = argv;
|
||||
*poption = option;
|
||||
*pvalue = value;
|
||||
return kind;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parses command line arguments. Returns JNI_FALSE if launcher
|
||||
* should exit without starting vm, returns JNI_TRUE if vm needs
|
||||
@ -1158,52 +1276,85 @@ ParseArguments(int *pargc, char ***pargv,
|
||||
*pret = 0;
|
||||
|
||||
while ((arg = *argv) != 0 && *arg == '-') {
|
||||
argv++; --argc;
|
||||
if (JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR1, arg);
|
||||
SetClassPath(*argv);
|
||||
mode = LM_CLASS;
|
||||
argv++; --argc;
|
||||
} else if (JLI_StrCmp(arg, "-modulepath") == 0 || JLI_StrCmp(arg, "-mp") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR4, arg);
|
||||
SetModulePath(*argv);
|
||||
argv++; --argc;
|
||||
} else if (JLI_StrCmp(arg, "-upgrademodulepath") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR4, arg);
|
||||
SetUpgradeModulePath(*argv);
|
||||
argv++; --argc;
|
||||
} else if (JLI_StrCmp(arg, "-jar") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR2, arg);
|
||||
char *option = NULL;
|
||||
char *value = NULL;
|
||||
int kind = GetOpt(&argc, &argv, &option, &value);
|
||||
jboolean has_arg = value != NULL;
|
||||
|
||||
/*
|
||||
* Option to set main entry point
|
||||
*/
|
||||
if (JLI_StrCmp(arg, "-jar") == 0) {
|
||||
ARG_CHECK(argc, ARG_ERROR2, arg);
|
||||
mode = LM_JAR;
|
||||
} else if (JLI_StrCmp(arg, "-m") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR5, arg);
|
||||
SetMainModule(*argv);
|
||||
} else if (JLI_StrCmp(arg, "--module") == 0 ||
|
||||
JLI_StrCCmp(arg, "--module=") == 0 ||
|
||||
JLI_StrCmp(arg, "-m") == 0) {
|
||||
REPORT_ERROR (has_arg, ARG_ERROR5, arg);
|
||||
SetMainModule(value);
|
||||
mode = LM_MODULE;
|
||||
} else if (JLI_StrCmp(arg, "-addmods") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR6, arg);
|
||||
SetAddModulesProp(*argv);
|
||||
argv++; --argc;
|
||||
} else if (JLI_StrCmp(arg, "-limitmods") == 0) {
|
||||
ARG_CHECK (argc, ARG_ERROR6, arg);
|
||||
SetLimitModulesProp(*argv);
|
||||
argv++; --argc;
|
||||
} else if (JLI_StrCmp(arg, "-listmods") == 0 ||
|
||||
JLI_StrCCmp(arg, "-listmods:") == 0) {
|
||||
if (has_arg) {
|
||||
*pwhat = value;
|
||||
break;
|
||||
}
|
||||
} else if (JLI_StrCmp(arg, "--class-path") == 0 ||
|
||||
JLI_StrCCmp(arg, "--class-path=") == 0 ||
|
||||
JLI_StrCmp(arg, "-classpath") == 0 ||
|
||||
JLI_StrCmp(arg, "-cp") == 0) {
|
||||
REPORT_ERROR (has_arg, ARG_ERROR1, arg);
|
||||
SetClassPath(value);
|
||||
mode = LM_CLASS;
|
||||
} else if (JLI_StrCmp(arg, "--list-modules") == 0 ||
|
||||
JLI_StrCCmp(arg, "--list-modules=") == 0) {
|
||||
listModules = arg;
|
||||
|
||||
// set listModules to --list-modules=<module-names> if argument is specified
|
||||
if (JLI_StrCmp(arg, "--list-modules") == 0 && has_arg) {
|
||||
static const char format[] = "%s=%s";
|
||||
size_t buflen = JLI_StrLen(option) + 2 + JLI_StrLen(value);
|
||||
listModules = JLI_MemAlloc(buflen);
|
||||
JLI_Snprintf(listModules, buflen, format, option, value);
|
||||
}
|
||||
return JNI_TRUE;
|
||||
} else if (JLI_StrCCmp(arg, "-XaddReads:") == 0) {
|
||||
static jint n;
|
||||
char *value = arg + 11;
|
||||
SetAddReadsProp(n++, value);
|
||||
} else if (JLI_StrCCmp(arg, "-XaddExports:") == 0) {
|
||||
static jint n;
|
||||
char *value = arg + 13;
|
||||
SetAddExportsProp(n++, value);
|
||||
} else if (JLI_StrCCmp(arg, "-Xpatch:") == 0) {
|
||||
static jint n;
|
||||
char *value = arg + 8;
|
||||
SetPatchProp(n++, value);
|
||||
} else if (JLI_StrCmp(arg, "-help") == 0 ||
|
||||
/*
|
||||
* Parse white-space options
|
||||
*/
|
||||
} else if (has_arg) {
|
||||
if (kind == VM_LONG_OPTION) {
|
||||
AddOption(option, NULL);
|
||||
} else if (kind == VM_LONG_OPTION_WITH_ARGUMENT) {
|
||||
AddLongFormOption(option, value);
|
||||
}
|
||||
/*
|
||||
* Error missing argument
|
||||
*/
|
||||
} else if (!has_arg && IsWhiteSpaceOption(arg)) {
|
||||
if (JLI_StrCmp(arg, "--module-path") == 0 ||
|
||||
JLI_StrCmp(arg, "-p") == 0 ||
|
||||
JLI_StrCmp(arg, "--upgrade-module-path") == 0) {
|
||||
REPORT_ERROR (has_arg, ARG_ERROR4, arg);
|
||||
} else if (JLI_StrCmp(arg, "--add-modules") == 0 ||
|
||||
JLI_StrCmp(arg, "--limit-modules") == 0 ||
|
||||
JLI_StrCmp(arg, "--add-exports") == 0 ||
|
||||
JLI_StrCmp(arg, "--add-reads") == 0 ||
|
||||
JLI_StrCmp(arg, "--patch-module") == 0) {
|
||||
REPORT_ERROR (has_arg, ARG_ERROR6, arg);
|
||||
}
|
||||
#ifndef OLD_MODULE_OPTIONS
|
||||
else if (JLI_StrCmp(arg, "-modulepath") == 0 ||
|
||||
JLI_StrCmp(arg, "-mp") == 0 ||
|
||||
JLI_StrCmp(arg, "-upgrademodulepath") == 0) {
|
||||
REPORT_ERROR (has_arg, ARG_ERROR4, arg);
|
||||
} else if (JLI_StrCmp(arg, "-addmods") == 0 ||
|
||||
JLI_StrCmp(arg, "-limitmods") == 0) {
|
||||
REPORT_ERROR (has_arg, ARG_ERROR6, arg);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* The following cases will cause the argument parsing to stop
|
||||
*/
|
||||
} else if (JLI_StrCmp(arg, "--help") == 0 ||
|
||||
JLI_StrCmp(arg, "-help") == 0 ||
|
||||
JLI_StrCmp(arg, "-h") == 0 ||
|
||||
JLI_StrCmp(arg, "-?") == 0) {
|
||||
printUsage = JNI_TRUE;
|
||||
@ -1282,7 +1433,7 @@ ParseArguments(int *pargc, char ***pargv,
|
||||
}
|
||||
}
|
||||
|
||||
if (--argc >= 0) {
|
||||
if (*pwhat == NULL && --argc >= 0) {
|
||||
*pwhat = *argv++;
|
||||
}
|
||||
|
||||
@ -1692,7 +1843,7 @@ static void
|
||||
ListModules(JNIEnv *env, char *optString)
|
||||
{
|
||||
jmethodID listModulesID;
|
||||
jstring joptString;
|
||||
jstring joptString = NULL;
|
||||
jclass cls = GetLauncherHelperClass(env);
|
||||
NULL_CHECK(cls);
|
||||
NULL_CHECK(listModulesID = (*env)->GetStaticMethodID(env, cls,
|
||||
|
@ -161,6 +161,7 @@ void SetJavaLauncherProp(void);
|
||||
jint ReadKnownVMs(const char *jvmcfg, jboolean speculative);
|
||||
char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
|
||||
void AddOption(char *str, void *info);
|
||||
jboolean IsWhiteSpaceOption(const char* name);
|
||||
|
||||
enum ergo_policy {
|
||||
DEFAULT_POLICY = 0,
|
||||
|
@ -91,7 +91,7 @@ class GNUStyleOptions {
|
||||
tool.xflag = true;
|
||||
}
|
||||
},
|
||||
new Option(false, OptionType.MAIN_OPERATION, "--print-module-descriptor", "-p") {
|
||||
new Option(false, OptionType.MAIN_OPERATION, "--print-module-descriptor", "-d") {
|
||||
void process(Main tool, String opt, String arg) throws BadArgs {
|
||||
if (tool.cflag || tool.iflag || tool.tflag || tool.uflag || tool.xflag)
|
||||
throw new BadArgs("error.multiple.main.operations").showUsage(true);
|
||||
@ -145,7 +145,7 @@ class GNUStyleOptions {
|
||||
}
|
||||
}
|
||||
},
|
||||
new Option(true, OptionType.CREATE_UPDATE, "--modulepath", "--mp") {
|
||||
new Option(true, OptionType.CREATE_UPDATE, "--module-path", "-p") {
|
||||
void process(Main jartool, String opt, String arg) {
|
||||
String[] dirs = arg.split(File.pathSeparator);
|
||||
Path[] paths = new Path[dirs.length];
|
||||
|
@ -201,7 +201,7 @@ main.help.opt.main.update=\
|
||||
main.help.opt.main.extract=\
|
||||
\ -x, --extract Extract named (or all) files from the archive
|
||||
main.help.opt.main.print-module-descriptor=\
|
||||
\ -p, --print-module-descriptor Print the module descriptor
|
||||
\ -d, --print-module-descriptor Print the module descriptor
|
||||
main.help.opt.any=\
|
||||
\ Operation modifiers valid in any mode:\n\
|
||||
\n\
|
||||
@ -232,8 +232,8 @@ main.help.opt.create.update.hash-modules=\
|
||||
\ matched by the given pattern and that depend upon\n\
|
||||
\ directly or indirectly on a modular jar being\n\
|
||||
\ created or a non-modular jar being updated
|
||||
main.help.opt.create.update.modulepath=\
|
||||
\ --modulepath Location of module dependence for generating
|
||||
main.help.opt.create.update.module-path=\
|
||||
\ -p, --module-path Location of module dependence for generating\n\
|
||||
\ the hash
|
||||
main.help.opt.create.update.index=\
|
||||
\ Operation modifiers valid only in create, update, and generate-index mode:\n
|
||||
@ -250,7 +250,7 @@ main.help.postopt=\
|
||||
\ located in the root of the given directories, or the root of the jar archive\n\
|
||||
\ itself. The following operations are only valid when creating a modular jar,\n\
|
||||
\ or updating an existing non-modular jar: '--module-version',\n\
|
||||
\ '--hash-modules', and '--modulepath'.\n\
|
||||
\ '--hash-modules', and '--module-path'.\n\
|
||||
\n\
|
||||
\ Mandatory or optional arguments to long options are also mandatory or optional\n\
|
||||
\ for any corresponding short options.
|
||||
\ for any corresponding short options.
|
||||
|
@ -61,11 +61,11 @@ class JImageTask {
|
||||
|
||||
new Option<JImageTask>(false, (task, option, arg) -> {
|
||||
task.options.fullVersion = true;
|
||||
}, true, "--fullversion"),
|
||||
}, true, "--full-version"),
|
||||
|
||||
new Option<JImageTask>(false, (task, option, arg) -> {
|
||||
task.options.help = true;
|
||||
}, "--help"),
|
||||
}, "--help", "-h"),
|
||||
|
||||
new Option<JImageTask>(false, (task, option, arg) -> {
|
||||
task.options.verbose = true;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
main.usage.summary=\
|
||||
Usage: {0} <extract | info | list | verify> <options> jimage...\n\
|
||||
use --help for a list of possible options.
|
||||
use -h or --help for a list of possible options.
|
||||
|
||||
main.usage=\
|
||||
Usage: {0} <extract | info | list | verify> <options> jimage...\n\
|
||||
@ -76,11 +76,11 @@ main.opt.footer=\
|
||||
\ used, one pattern per line\n\
|
||||
|
||||
|
||||
main.opt.fullversion=\
|
||||
\ --fullversion Print full version information
|
||||
main.opt.full-version=\
|
||||
\ --full-version Print full version information
|
||||
|
||||
main.opt.help=\
|
||||
\ --help Print usage message
|
||||
\ -h, --help Print usage message
|
||||
|
||||
main.opt.verbose=\
|
||||
\ --verbose Listing prints entry size and offset attributes
|
||||
|
@ -84,31 +84,32 @@ public class JlinkTask {
|
||||
private static final Option<?>[] recognizedOptions = {
|
||||
new Option<JlinkTask>(false, (task, opt, arg) -> {
|
||||
task.options.help = true;
|
||||
}, "--help"),
|
||||
}, "--help", "-h"),
|
||||
new Option<JlinkTask>(true, (task, opt, arg) -> {
|
||||
String[] dirs = arg.split(File.pathSeparator);
|
||||
int i = 0;
|
||||
Arrays.stream(dirs)
|
||||
.map(Paths::get)
|
||||
.forEach(task.options.modulePath::add);
|
||||
}, "--modulepath", "--mp"),
|
||||
}, "--module-path", "-p"),
|
||||
new Option<JlinkTask>(true, (task, opt, arg) -> {
|
||||
for (String mn : arg.split(",")) {
|
||||
if (mn.isEmpty()) {
|
||||
throw taskHelper.newBadArgs("err.mods.must.be.specified",
|
||||
"--limitmods");
|
||||
"--limit-modules");
|
||||
}
|
||||
task.options.limitMods.add(mn);
|
||||
}
|
||||
}, "--limitmods"),
|
||||
}, "--limit-modules"),
|
||||
new Option<JlinkTask>(true, (task, opt, arg) -> {
|
||||
for (String mn : arg.split(",")) {
|
||||
if (mn.isEmpty()) {
|
||||
throw taskHelper.newBadArgs("err.mods.must.be.specified",
|
||||
"--addmods");
|
||||
"--add-modules");
|
||||
}
|
||||
task.options.addMods.add(mn);
|
||||
}
|
||||
}, "--addmods"),
|
||||
}, "--add-modules"),
|
||||
new Option<JlinkTask>(true, (task, opt, arg) -> {
|
||||
Path path = Paths.get(arg);
|
||||
task.options.output = path;
|
||||
@ -134,10 +135,10 @@ public class JlinkTask {
|
||||
}, true, "--keep-packaged-modules"),
|
||||
new Option<JlinkTask>(true, (task, opt, arg) -> {
|
||||
task.options.saveoptsfile = arg;
|
||||
}, "--saveopts"),
|
||||
}, "--save-opts"),
|
||||
new Option<JlinkTask>(false, (task, opt, arg) -> {
|
||||
task.options.fullVersion = true;
|
||||
}, true, "--fullversion"),};
|
||||
}, true, "--full-version"),};
|
||||
|
||||
private static final String PROGNAME = "jlink";
|
||||
private final OptionsValues options = new OptionsValues();
|
||||
@ -294,7 +295,7 @@ public class JlinkTask {
|
||||
try {
|
||||
options.addMods = checkAddMods(options.addMods);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
throw taskHelper.newBadArgs("err.mods.must.be.specified", "--addmods")
|
||||
throw taskHelper.newBadArgs("err.mods.must.be.specified", "--add-modules")
|
||||
.showUsage(true);
|
||||
}
|
||||
// First create the image provider
|
||||
|
@ -196,7 +196,7 @@ public final class TaskHelper {
|
||||
// This option is handled prior
|
||||
// to have the options parsed.
|
||||
},
|
||||
"--plugins-modulepath"));
|
||||
"--plugin-module-path"));
|
||||
mainOptions.add(new PlugOption(true, (task, opt, arg) -> {
|
||||
Path path = Paths.get(arg);
|
||||
if (!Files.exists(path) || !Files.isDirectory(path)) {
|
||||
|
@ -24,30 +24,31 @@
|
||||
#
|
||||
|
||||
main.usage.summary=\
|
||||
Usage: {0} <options> --modulepath <modulepath> --addmods <mods> --output <path>\n\
|
||||
Usage: {0} <options> --module-path <modulepath> --add-modules <mods> --output <path>\n\
|
||||
use --help for a list of possible options
|
||||
|
||||
main.usage=\
|
||||
Usage: {0} <options> --modulepath <modulepath> --addmods <mods> --output <path>\n\
|
||||
Usage: {0} <options> --module-path <modulepath> --add-modules <mods> --output <path>\n\
|
||||
\Possible options include:
|
||||
|
||||
error.prefix=Error:
|
||||
warn.prefix=Warning:
|
||||
|
||||
main.opt.help=\
|
||||
\ --help Print this help message
|
||||
\ -h, --help Print this help message
|
||||
|
||||
main.opt.version=\
|
||||
\ --version Version information
|
||||
|
||||
main.opt.modulepath=\
|
||||
\ --modulepath <modulepath> Module path
|
||||
main.opt.module-path=\
|
||||
\ -p <modulepath>\n\
|
||||
\ --module-path <modulepath> Module path
|
||||
|
||||
main.opt.addmods=\
|
||||
\ --addmods <mod>[,<mod>...] Root modules to resolve
|
||||
main.opt.add-modules=\
|
||||
\ --add-modules <mod>[,<mod>...] Root modules to resolve
|
||||
|
||||
main.opt.limitmods=\
|
||||
\ --limitmods <mod>[,<mod>...] Limit the universe of observable modules
|
||||
main.opt.limit-modules=\
|
||||
\ --limit-modules <mod>[,<mod>...] Limit the universe of observable modules
|
||||
|
||||
main.opt.output=\
|
||||
\ --output <path> Location of output path
|
||||
@ -58,8 +59,8 @@ main.command.files=\
|
||||
main.opt.endian=\
|
||||
\ --endian <little|big> Byte order of generated jimage (default:native)
|
||||
|
||||
main.opt.saveopts=\
|
||||
\ --saveopts <filename> Save jlink options in the given file
|
||||
main.opt.save-opts=\
|
||||
\ --save-opts <filename> Save jlink options in the given file
|
||||
|
||||
main.msg.bug=\
|
||||
An exception has occurred in jlink. \
|
||||
@ -83,7 +84,7 @@ main.extended.help.footer=\
|
||||
|
||||
err.unknown.byte.order:unknown byte order {0}
|
||||
err.output.must.be.specified:--output must be specified
|
||||
err.modulepath.must.be.specified:--modulepath must be specified
|
||||
err.modulepath.must.be.specified:--module-path must be specified
|
||||
err.mods.must.be.specified:no modules specified to {0}
|
||||
err.path.not.found=path not found: {0}
|
||||
err.path.not.valid=invalid path: {0}
|
||||
|
@ -115,7 +115,7 @@ include-locales.invalidtag=\
|
||||
Invalid language tag: %s
|
||||
|
||||
include-locales.localedatanotfound=\
|
||||
jdk.localedata module was not specified with --addmods option
|
||||
jdk.localedata module was not specified with --add-modules option
|
||||
|
||||
main.status.ok=Functional.
|
||||
|
||||
@ -133,8 +133,8 @@ plugin.opt.post-process-path=\
|
||||
plugin.opt.resources-last-sorter=\
|
||||
\ --resources-last-sorter <name> The last plugin allowed to sort resources
|
||||
|
||||
plugin.opt.plugins-modulepath=\
|
||||
\ --plugin-module-path <modulepath> Custom plugins module path
|
||||
plugin.opt.plugin-module-path=\
|
||||
\ --plugin-module-path <modulepath> Custom plugin module path
|
||||
|
||||
plugin.opt.c=\
|
||||
\ -c, --compress=2 Enable compression of resources (level 2)
|
||||
|
@ -1181,7 +1181,7 @@ public class JmodTask {
|
||||
}
|
||||
}
|
||||
|
||||
private final OptionParser parser = new OptionParser();
|
||||
private final OptionParser parser = new OptionParser("hp");
|
||||
|
||||
private void handleOptions(String[] args) {
|
||||
parser.formatHelpWith(new JmodHelpFormatter());
|
||||
@ -1218,7 +1218,7 @@ public class JmodTask {
|
||||
.withValuesConvertedBy(new PatternConverter());
|
||||
|
||||
OptionSpec<Void> help
|
||||
= parser.accepts("help", getMessage("main.opt.help"))
|
||||
= parser.acceptsAll(Set.of("h", "help"), getMessage("main.opt.help"))
|
||||
.forHelp();
|
||||
|
||||
OptionSpec<Path> libs
|
||||
@ -1232,9 +1232,9 @@ public class JmodTask {
|
||||
.withRequiredArg()
|
||||
.describedAs(getMessage("main.opt.main-class.arg"));
|
||||
|
||||
OptionSpec<Path> modulePath // TODO: short version of --mp ??
|
||||
= parser.acceptsAll(Arrays.asList("mp", "modulepath"),
|
||||
getMessage("main.opt.modulepath"))
|
||||
OptionSpec<Path> modulePath
|
||||
= parser.acceptsAll(Set.of("p", "module-path"),
|
||||
getMessage("main.opt.module-path"))
|
||||
.withRequiredArg()
|
||||
.withValuesSeparatedBy(File.pathSeparatorChar)
|
||||
.withValuesConvertedBy(DirPathConverter.INSTANCE);
|
||||
|
@ -63,7 +63,7 @@ main.opt.os-arch=Operating system architecture
|
||||
main.opt.os-arch.arg=os-arch
|
||||
main.opt.os-version=Operating system version
|
||||
main.opt.os-version.arg=os-version
|
||||
main.opt.modulepath=Module path
|
||||
main.opt.module-path=Module path
|
||||
main.opt.hash-modules=Compute and record hashes to tie a packaged module\
|
||||
\ with modules matching the given <regex-pattern> and depending upon it directly\
|
||||
\ or indirectly. The hashes are recorded in the JMOD file being created, or\
|
||||
|
@ -343,6 +343,9 @@ com/sun/jdi/GetLocalVariables4Test.sh 8067354 windows-
|
||||
|
||||
com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows-all
|
||||
|
||||
com/sun/jdi/ClassesByName2Test.java 8160833 generic-all
|
||||
com/sun/jdi/RedefineCrossEvent.java 8160833 generic-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_time
|
||||
|
@ -26,12 +26,12 @@ groups=TEST.groups [closed/TEST.groups]
|
||||
# Allow querying of various System properties in @requires clauses
|
||||
requires.properties=sun.arch.data.model java.runtime.name
|
||||
|
||||
# Tests using jtreg 4.2 b02 features
|
||||
requiredVersion=4.2 b02
|
||||
# Tests using jtreg 4.2 b03 features
|
||||
requiredVersion=4.2 b03
|
||||
|
||||
# Path to libraries in the topmost test directory. This is needed so @library
|
||||
# does not need ../../ notation to reach them
|
||||
external.lib.roots = ../../
|
||||
|
||||
# Use new form of -Xpatch
|
||||
useNewXpatch=true
|
||||
# Use new module options
|
||||
useNewOptions=true
|
||||
|
@ -81,9 +81,9 @@ cp ${TESTSRC}${FS}JavaBug.java bug
|
||||
|
||||
chmod -fR 777 bug
|
||||
|
||||
${COMPILEJAVA}${FS}bin${FS}javac -addmods java.corba -d . bug${FS}*.java
|
||||
${COMPILEJAVA}${FS}bin${FS}javac --add-modules java.corba -d . bug${FS}*.java
|
||||
|
||||
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -addmods java.corba -cp . bug/JavaBug > test.out 2>&1
|
||||
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} --add-modules java.corba -cp . bug/JavaBug > test.out 2>&1
|
||||
|
||||
grep "NullPointerException" test.out
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
||||
* @summary Four helper classes missing in Sun JDK
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.*
|
||||
* @compile -addmods java.corba CorbaExceptionsCompileTest.java
|
||||
* @run main/othervm -addmods java.corba CorbaExceptionsCompileTest
|
||||
* @modules java.corba
|
||||
* @run main CorbaExceptionsCompileTest
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
|
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @bug 7095856
|
||||
* @summary OutputStreamHook doesn't handle null values
|
||||
* @compile -addmods java.corba HookPutFieldsTest.java
|
||||
* @run main/othervm -addmods java.corba HookPutFieldsTest
|
||||
* @modules java.corba
|
||||
* @run main HookPutFieldsTest
|
||||
*/
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @bug 8028215
|
||||
* @summary SetDefaultORBTest setting ORB impl via properties test
|
||||
* @compile -addmods java.corba SetDefaultORBTest.java
|
||||
* @run main/othervm -addmods java.corba SetDefaultORBTest
|
||||
* @modules java.corba
|
||||
* @run main SetDefaultORBTest
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -99,11 +99,11 @@ env
|
||||
set -vx
|
||||
#
|
||||
# Compile test class
|
||||
${TESTJAVA}/bin/javac -XaddExports:jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED \
|
||||
${TESTJAVA}/bin/javac --add-exports jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED \
|
||||
-d "${TESTCLASSES}" ${CP} -g "${TESTSRC}"/"${TARGETCLASS}".java
|
||||
#
|
||||
# Run the test class, again with the classpath we need:
|
||||
${TESTJAVA}/bin/java -XaddExports:jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED \
|
||||
${TESTJAVA}/bin/java --add-exports jdk.jdi/com.sun.tools.example.debug.tty=ALL-UNNAMED \
|
||||
${CP} ${TARGETCLASS}
|
||||
status=$?
|
||||
echo "test status was: $status"
|
||||
|
@ -26,6 +26,7 @@
|
||||
* @summary Tests that JNDI/COS naming parser supports the syntax
|
||||
* defined in the new INS standard.
|
||||
* @modules java.corba/com.sun.jndi.cosnaming
|
||||
* @run main/othervm CNNameParser
|
||||
*/
|
||||
|
||||
import javax.naming.*;
|
||||
|
@ -25,6 +25,7 @@
|
||||
* @bug 5042453
|
||||
* @summary Ipv6 address throws Non-numeric port number error
|
||||
* @modules java.corba/com.sun.jndi.cosnaming
|
||||
* @run main/othervm IiopUrlIPv6
|
||||
*/
|
||||
|
||||
import com.sun.jndi.cosnaming.*;
|
||||
|
@ -61,7 +61,7 @@ public class CheckOrigin {
|
||||
|
||||
ProcessBuilder pb = ProcessTools.
|
||||
createJavaProcessBuilder(
|
||||
"-XaddExports:jdk.attach/sun.tools.attach=ALL-UNNAMED",
|
||||
"--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED",
|
||||
"-XX:+UseConcMarkSweepGC", // this will cause UseParNewGC to be FLAG_SET_ERGO
|
||||
"-XX:+UseCodeAging",
|
||||
"-XX:+UseCerealGC", // Should be ignored.
|
||||
|
@ -55,7 +55,7 @@ public class GtkVersionTest {
|
||||
"/bin/java " +
|
||||
(version == null ? "" : "-Djdk.gtk.version=" + version) +
|
||||
" -Djdk.gtk.verbose=true " +
|
||||
"-XaddExports:java.desktop/sun.awt=ALL-UNNAMED " +
|
||||
"--add-exports=java.desktop/sun.awt=ALL-UNNAMED " +
|
||||
"-cp " + System.getProperty("java.class.path", ".") +
|
||||
" GtkVersionTest$LoadGtk");
|
||||
p.waitFor();
|
||||
|
@ -113,8 +113,8 @@ fi
|
||||
case "$OS" in
|
||||
Windows* | CYGWIN* )
|
||||
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
|
||||
*.java
|
||||
status=$?
|
||||
if [ ! $status -eq "0" ]; then
|
||||
@ -124,8 +124,8 @@ case "$OS" in
|
||||
|
||||
SunOS | Linux )
|
||||
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
|
||||
*.java
|
||||
status=$?
|
||||
if [ ! $status -eq "0" ]; then
|
||||
@ -135,8 +135,8 @@ case "$OS" in
|
||||
|
||||
Darwin)
|
||||
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
|
||||
*.java
|
||||
status=$?
|
||||
if [ ! $status -eq "0" ]; then
|
||||
@ -154,16 +154,16 @@ chmod 777 ./*
|
||||
case "$OS" in
|
||||
Windows* | CYGWIN* )
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
|
||||
TestWrapped sun.awt.windows.WToolkit
|
||||
status=$?
|
||||
if [ ! $status -eq "0" ]; then
|
||||
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.windows.WToolkit";
|
||||
fi
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
|
||||
-Dawt.toolkit=sun.awt.windows.WToolkit \
|
||||
TestWrapped sun.awt.windows.WToolkit
|
||||
status=$?
|
||||
@ -174,8 +174,8 @@ case "$OS" in
|
||||
|
||||
SunOS | Linux )
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
|
||||
-Dawt.toolkit=sun.awt.X11.XToolkit \
|
||||
TestWrapped sun.awt.X11.XToolkit
|
||||
status=$?
|
||||
@ -183,8 +183,8 @@ case "$OS" in
|
||||
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
|
||||
fi
|
||||
AWT_TOOLKIT=XToolkit ${TESTJAVA}/bin/java ${TESTVMOPTS} \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
|
||||
-Djava.awt.headless=true \
|
||||
TestWrapped sun.awt.X11.XToolkit
|
||||
status=$?
|
||||
@ -195,16 +195,16 @@ case "$OS" in
|
||||
|
||||
Darwin)
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
|
||||
TestWrapped sun.lwawt.macosx.LWCToolkit
|
||||
status=$?
|
||||
if [ ! $status -eq "0" ]; then
|
||||
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
|
||||
fi
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
|
||||
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
|
||||
-XaddExports:java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
|
||||
--add-exports java.desktop/sun.awt=ALL-UNNAMED \
|
||||
--add-exports java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
|
||||
-Dawt.toolkit=sun.lwawt.macosx.LWCToolkit \
|
||||
TestWrapped sun.lwawt.macosx.LWCToolkit
|
||||
status=$?
|
||||
|
@ -73,10 +73,11 @@ public class RunTestXEmbed extends TestXEmbedServer {
|
||||
enva[ind++] = "AWT_TOOLKIT=sun.awt.X11.XToolkit";
|
||||
}
|
||||
}
|
||||
Process proc = Runtime.getRuntime().exec(java_home +
|
||||
"/bin/java -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient "
|
||||
+ test.getName() + " " + window + buf,
|
||||
enva);
|
||||
Process proc = Runtime.getRuntime().
|
||||
exec(java_home +
|
||||
"/bin/java --add-exports java.desktop/sun.awt.X11=ALL-UNNAMED -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient "
|
||||
+ test.getName() + " " + window + buf,
|
||||
enva);
|
||||
System.err.println("Test for " + test.getName() + " has started.");
|
||||
log.fine("Test for " + test.getName() + " has started.");
|
||||
new InputReader(proc.getInputStream());
|
||||
|
@ -84,11 +84,11 @@ public class TestXEmbedServerJava extends TestXEmbedServer {
|
||||
}
|
||||
if (hasModules) {
|
||||
System.out.println(java_home +
|
||||
"/bin/java -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED "+
|
||||
"-XaddExports:java.desktop/sun.awt=ALL-UNNAMED JavaClient " + window);
|
||||
"/bin/java --add-exports java.desktop/sun.awt.X11=ALL-UNNAMED "+
|
||||
"--add-exports java.desktop/sun.awt=ALL-UNNAMED JavaClient " + window);
|
||||
return Runtime.getRuntime().exec(java_home +
|
||||
"/bin/java -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED "+
|
||||
"-XaddExports:java.desktop/sun.awt=ALL-UNNAMED JavaClient " + window);
|
||||
"/bin/java --add-exports java.desktop/sun.awt.X11=ALL-UNNAMED "+
|
||||
"--add-exports java.desktop/sun.awt=ALL-UNNAMED JavaClient " + window);
|
||||
}else{
|
||||
System.out.println(java_home + "/bin/java JavaClient " + window);
|
||||
return Runtime.getRuntime().exec(java_home + "/bin/java JavaClient " + window);
|
||||
|
@ -39,7 +39,7 @@ import java.util.List;
|
||||
* java.corba
|
||||
* java.xml.bind
|
||||
* @compile -XDignore.symbol.file TestConstructorFinder.java
|
||||
* @run main/othervm -addmods java.activation -addmods java.transaction -addmods java.corba -addmods java.xml.bind TestConstructorFinder
|
||||
* @run main/othervm --add-modules=java.activation,java.transaction,java.corba,java.xml.bind TestConstructorFinder
|
||||
*/
|
||||
|
||||
public class TestConstructorFinder {
|
||||
|
@ -39,7 +39,7 @@ import java.util.List;
|
||||
* java.corba
|
||||
* java.xml.bind
|
||||
* @compile -XDignore.symbol.file TestMethodFinder.java
|
||||
* @run main/othervm -addmods java.activation -addmods java.transaction -addmods java.corba -addmods java.xml.bind TestMethodFinder
|
||||
* @run main/othervm --add-modules=java.activation,java.transaction,java.corba,java.xml.bind TestMethodFinder
|
||||
*/
|
||||
|
||||
public class TestMethodFinder {
|
||||
|
@ -65,7 +65,7 @@ public class TestDriver {
|
||||
public void setup() throws Exception {
|
||||
assertTrue(CompilerUtils.compile(
|
||||
MOD_SRC_DIR, MOD_DEST_DIR,
|
||||
"-modulesourcepath",
|
||||
"--module-source-path",
|
||||
MOD_SRC_DIR.toString()));
|
||||
|
||||
copyDirectories(MOD_DEST_DIR.resolve("m1"), Paths.get("mods1"));
|
||||
@ -76,8 +76,8 @@ public class TestDriver {
|
||||
public void test() throws Exception {
|
||||
String[] options = new String[] {
|
||||
"-cp", TEST_CLASSES,
|
||||
"-mp", MOD_DEST_DIR.toString(),
|
||||
"-addmods", String.join(",", modules),
|
||||
"--module-path", MOD_DEST_DIR.toString(),
|
||||
"--add-modules", String.join(",", modules),
|
||||
"-m", "m2/p2.test.Main"
|
||||
};
|
||||
runTest(options);
|
||||
@ -87,8 +87,8 @@ public class TestDriver {
|
||||
public void testUnnamedModule() throws Exception {
|
||||
String[] options = new String[] {
|
||||
"-cp", TEST_CLASSES,
|
||||
"-mp", MOD_DEST_DIR.toString(),
|
||||
"-addmods", String.join(",", modules),
|
||||
"--module-path", MOD_DEST_DIR.toString(),
|
||||
"--add-modules", String.join(",", modules),
|
||||
"TestMain"
|
||||
};
|
||||
runTest(options);
|
||||
@ -107,8 +107,8 @@ public class TestDriver {
|
||||
@Test
|
||||
public void testDeniedClassLoaderAccess() throws Exception {
|
||||
String[] options = new String[] {
|
||||
"-mp", MOD_DEST_DIR.toString(),
|
||||
"-addmods", String.join(",", modules),
|
||||
"--module-path", MOD_DEST_DIR.toString(),
|
||||
"--add-modules", String.join(",", modules),
|
||||
"-m", "m3/p3.NoGetClassLoaderAccess"
|
||||
};
|
||||
assertTrue(executeTestJava(options)
|
||||
@ -124,8 +124,8 @@ public class TestDriver {
|
||||
String[] options = new String[] {
|
||||
"-Djava.security.manager",
|
||||
"-Djava.security.policy=" + policyFile.toString(),
|
||||
"-mp", MOD_DEST_DIR.toString(),
|
||||
"-addmods", String.join(",", modules),
|
||||
"--module-path", MOD_DEST_DIR.toString(),
|
||||
"--add-modules", String.join(",", modules),
|
||||
"-m", "m3/p3.NoAccess"
|
||||
};
|
||||
assertTrue(executeTestJava(options)
|
||||
|
@ -63,8 +63,8 @@ import jdk.internal.module.Modules;
|
||||
* loads all the classes in the BCL, get their declared fields,
|
||||
* and call setAccessible(false) followed by setAccessible(true);
|
||||
* @modules java.base/jdk.internal.module
|
||||
* @run main/othervm -Djdk.launcher.addmods=ALL-SYSTEM FieldSetAccessibleTest UNSECURE
|
||||
* @run main/othervm -Djdk.launcher.addmods=ALL-SYSTEM FieldSetAccessibleTest SECURE
|
||||
* @run main/othervm --add-modules=ALL-SYSTEM FieldSetAccessibleTest UNSECURE
|
||||
* @run main/othervm --add-modules=ALL-SYSTEM FieldSetAccessibleTest SECURE
|
||||
*
|
||||
* @author danielfuchs
|
||||
*/
|
||||
|
@ -60,15 +60,15 @@ public class ResourcesTest {
|
||||
compiled = CompilerUtils
|
||||
.compile(SRC_DIR,
|
||||
MODS_DIR,
|
||||
"-modulesourcepath", SRC_DIR.toString());
|
||||
"--module-source-path", SRC_DIR.toString());
|
||||
assertTrue(compiled);
|
||||
|
||||
// javac -mp mods -d classes Main.java
|
||||
// javac --module-path mods -d classes Main.java
|
||||
compiled = CompilerUtils
|
||||
.compile(Paths.get(TEST_SRC, "Main.java"),
|
||||
CLASSES_DIR,
|
||||
"-mp", MODS_DIR.toString(),
|
||||
"-addmods", "m1,m2,m3");
|
||||
"--module-path", MODS_DIR.toString(),
|
||||
"--add-modules", "m1,m2,m3");
|
||||
assertTrue(compiled);
|
||||
|
||||
}
|
||||
@ -79,8 +79,8 @@ public class ResourcesTest {
|
||||
public void runTest() throws Exception {
|
||||
|
||||
int exitValue
|
||||
= executeTestJava("-mp", MODS_DIR.toString(),
|
||||
"-addmods", "m1,m2,m3",
|
||||
= executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"--add-modules", "m1,m2,m3",
|
||||
"-cp", CLASSES_DIR.toString(),
|
||||
"Main")
|
||||
.outputTo(System.out)
|
||||
|
@ -56,19 +56,19 @@ public class ResourcesTest {
|
||||
public void compileAll() throws Exception {
|
||||
boolean compiled;
|
||||
|
||||
// javac -modulesource mods -d mods src/**
|
||||
// javac --module-source-path mods -d mods src/**
|
||||
compiled = CompilerUtils
|
||||
.compile(SRC_DIR,
|
||||
MODS_DIR,
|
||||
"-modulesourcepath", SRC_DIR.toString());
|
||||
"--module-source-path", SRC_DIR.toString());
|
||||
assertTrue(compiled);
|
||||
|
||||
// javac -mp mods -d classes Main.java
|
||||
// javac --module-path mods -d classes Main.java
|
||||
compiled = CompilerUtils
|
||||
.compile(Paths.get(TEST_SRC, "Main.java"),
|
||||
CLASSES_DIR,
|
||||
"-mp", MODS_DIR.toString(),
|
||||
"-addmods", "m1,m2,m3");
|
||||
"--module-path", MODS_DIR.toString(),
|
||||
"--add-modules", "m1,m2,m3");
|
||||
assertTrue(compiled);
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ public class ResourcesTest {
|
||||
*/
|
||||
public void runTest() throws Exception {
|
||||
int exitValue
|
||||
= executeTestJava("-mp", MODS_DIR.toString(),
|
||||
"-addmods", "m1,m2,m3",
|
||||
= executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"--add-modules", "m1,m2,m3",
|
||||
"-cp", CLASSES_DIR.toString(),
|
||||
"Main")
|
||||
.outputTo(System.out)
|
||||
|
@ -51,15 +51,15 @@ JAVAC="$COMPILEJAVA/bin/javac"
|
||||
JAVA="$TESTJAVA/bin/java ${TESTVMOPTS}"
|
||||
|
||||
mkdir -p mods
|
||||
$JAVAC -d mods -modulesourcepath ${TESTSRC} `find ${TESTSRC}/m -name "*.java"`
|
||||
$JAVAC -d mods --module-source-path ${TESTSRC} `find ${TESTSRC}/m -name "*.java"`
|
||||
|
||||
mkdir -p classes
|
||||
$JAVAC -d classes ${TESTSRC}/Test.java
|
||||
|
||||
$JAVA -cp classes -mp mods -addmods m \
|
||||
$JAVA -cp classes --module-path mods --add-modules m \
|
||||
-Djava.security.manager \
|
||||
-Djava.security.policy=${TESTSRC}/test.policy Test
|
||||
$JAVA -cp classes -mp mods -addmods m \
|
||||
$JAVA -cp classes --module-path mods --add-modules m \
|
||||
-Djava.security.manager=p.CustomSecurityManager \
|
||||
-Djava.security.policy=${TESTSRC}/test.policy Test
|
||||
|
||||
|
@ -38,13 +38,13 @@ import java.security.Permission;
|
||||
* @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT WithSecurityManager
|
||||
*
|
||||
* @run main/othervm -Xverify:all -limitmods java.base WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -limitmods java.base -Djava.lang.invoke.stringConcat=BC_SB WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -limitmods java.base -Djava.lang.invoke.stringConcat=BC_SB_SIZED WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -limitmods java.base -Djava.lang.invoke.stringConcat=MH_SB_SIZED WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -limitmods java.base -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -limitmods java.base -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT WithSecurityManager
|
||||
* @run main/othervm -Xverify:all -limitmods java.base -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=BC_SB WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=BC_SB_SIZED WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=MH_SB_SIZED WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT WithSecurityManager
|
||||
* @run main/othervm -Xverify:all --limit-modules=java.base -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT WithSecurityManager
|
||||
*/
|
||||
public class WithSecurityManager {
|
||||
public static void main(String[] args) throws Throwable {
|
||||
|
@ -87,7 +87,7 @@ ${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} bootreporter/*.java
|
||||
cd ..
|
||||
|
||||
${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
|
||||
-XaddExports:java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED ${AGENT}.java asmlib/*.java
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED ${AGENT}.java asmlib/*.java
|
||||
${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -classpath .${PATHSEP}bootpath ${APP}.java
|
||||
|
||||
echo "Manifest-Version: 1.0" > ${AGENT}.mf
|
||||
|
@ -60,7 +60,7 @@ public class ModuleAccessControlTest {
|
||||
for (String mn : modules) {
|
||||
Path msrc = SRC_DIR.resolve(mn);
|
||||
assertTrue(CompilerUtils
|
||||
.compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString()));
|
||||
.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ public class ModuleAccessControlTest {
|
||||
*/
|
||||
@Test
|
||||
public void runTest() throws Exception {
|
||||
int exitValue = executeTestJava("-mp", MODS_DIR.toString(),
|
||||
int exitValue = executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"-m", "m1/p1.Main")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out)
|
||||
|
@ -63,9 +63,9 @@ public class LayerAndLoadersTest {
|
||||
@BeforeTest
|
||||
public void setup() throws Exception {
|
||||
|
||||
// javac -d mods -modulesourcepath src src/**
|
||||
// javac -d mods --module-source-path src src/**
|
||||
assertTrue(CompilerUtils.compile(SRC_DIR, MODS_DIR,
|
||||
"-modulesourcepath", SRC_DIR.toString()));
|
||||
"--module-source-path", SRC_DIR.toString()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
|
@ -23,29 +23,44 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @modules java.desktop
|
||||
* @run main/othervm -XaddExports:java.desktop/sun.awt=java.base AddExportsTest
|
||||
* @run main/othervm -XaddExports:java.desktop/sun.awt=ALL-UNNAMED AddExportsTest
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.desktop
|
||||
* @run main/othervm --add-exports=java.desktop/sun.awt=java.base AddExportsTest
|
||||
* @run main/othervm --add-exports=java.desktop/sun.awt=ALL-UNNAMED AddExportsTest
|
||||
* @summary Test Module isExported methods with exports changed by -AddExportsTest
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Layer;
|
||||
import java.lang.reflect.Module;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.internal.misc.VM;
|
||||
|
||||
public class AddExportsTest {
|
||||
/*
|
||||
* jtreg sets -Dtest.modules system property to the internal APIs
|
||||
* specified at @modules tag. The test will exclude --add-exports set
|
||||
* for @modules.
|
||||
*/
|
||||
private static final String TEST_MODULES = System.getProperty("test.modules");
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String addExports = System.getProperty("jdk.launcher.addexports.0");
|
||||
assertTrue(addExports != null, "Expected to be run with -XaddExports");
|
||||
Optional<String> oaddExports = Stream.of(VM.getRuntimeArguments())
|
||||
.filter(arg -> arg.startsWith("--add-exports="))
|
||||
.filter(arg -> !arg.equals("--add-exports=" + TEST_MODULES + "=ALL-UNNAMED"))
|
||||
.map(arg -> arg.substring("--add-exports=".length(), arg.length()))
|
||||
.findFirst();
|
||||
|
||||
assertTrue(oaddExports.isPresent());
|
||||
|
||||
Layer bootLayer = Layer.boot();
|
||||
|
||||
Module unnamedModule = AddExportsTest.class.getModule();
|
||||
assertFalse(unnamedModule.isNamed());
|
||||
|
||||
for (String expr : addExports.split(",")) {
|
||||
for (String expr : oaddExports.get().split(",")) {
|
||||
|
||||
String[] s = expr.split("=");
|
||||
assertTrue(s.length == 2);
|
||||
|
@ -72,8 +72,8 @@ public class AccessTest {
|
||||
*/
|
||||
public void runTest() throws Exception {
|
||||
int exitValue
|
||||
= executeTestJava("-mp", MODS_DIR.toString(),
|
||||
"-addmods", "target",
|
||||
= executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"--add-modules", "target",
|
||||
"-m", "test/test.Main")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out)
|
||||
|
@ -64,7 +64,7 @@ public class ProxyClassAccessTest {
|
||||
public void compileAll() throws Exception {
|
||||
for (String mn : modules) {
|
||||
Path msrc = SRC_DIR.resolve(mn);
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString()));
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public class ProxyClassAccessTest {
|
||||
*/
|
||||
@Test
|
||||
public void runTest() throws Exception {
|
||||
int exitValue = executeTestJava("-mp", MODS_DIR.toString(),
|
||||
int exitValue = executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"-m", "test/jdk.test.ProxyClassAccess")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out)
|
||||
|
@ -65,7 +65,7 @@ public class ProxyLayerTest {
|
||||
public void compileAll() throws Exception {
|
||||
for (String mn : modules) {
|
||||
Path msrc = SRC_DIR.resolve(mn);
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString()));
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class ProxyModuleMapping {
|
||||
Module unnamed = ld.getUnnamedModule();
|
||||
new ProxyModuleMapping(unnamed, Runnable.class).test();
|
||||
|
||||
// unnamed module gets access to sun.invoke package (e.g. via -XaddExports)
|
||||
// unnamed module gets access to sun.invoke package (e.g. via --add-exports)
|
||||
new ProxyModuleMapping(sun.invoke.WrapperInstance.class).test();
|
||||
|
||||
Class<?> modulePrivateIntf = Class.forName("sun.net.ProgressListener");
|
||||
|
@ -61,7 +61,7 @@ public class ProxyTest {
|
||||
public void compileAll() throws Exception {
|
||||
for (String mn : modules) {
|
||||
Path msrc = SRC_DIR.resolve(mn);
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString()));
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ public class ProxyTest {
|
||||
@Test
|
||||
public void runTest() throws Exception {
|
||||
int exitValue = executeTestJava("-cp", CPATH_DIR.toString(),
|
||||
"-mp", MODS_DIR.toString(),
|
||||
"--module-path", MODS_DIR.toString(),
|
||||
"-m", "test/jdk.test.Main")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out)
|
||||
|
@ -44,7 +44,7 @@ case "$OS" in
|
||||
;;
|
||||
esac
|
||||
|
||||
EXTRAOPTS="-XaddExports:java.base/sun.net.www=ALL-UNNAMED -XaddExports:java.base/sun.net.www.protocol.http=ALL-UNNAMED"
|
||||
EXTRAOPTS="--add-exports java.base/sun.net.www=ALL-UNNAMED --add-exports java.base/sun.net.www.protocol.http=ALL-UNNAMED"
|
||||
export EXTRAOPTS
|
||||
|
||||
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . \
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @bug 8036979 8072384 8044773
|
||||
* @run main/othervm -Xcheck:jni OptionsTest
|
||||
* @run main/othervm -Xcheck:jni -Djava.net.preferIPv4Stack=true OptionsTest
|
||||
* @run main/othervm -limitmods java.base OptionsTest
|
||||
* @run main/othervm --limit-modules=java.base OptionsTest
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -33,7 +33,7 @@ import java.util.List;
|
||||
* @summary Test checks that UnsupportedOperationException for unsupported
|
||||
* SOCKET_OPTIONS is thrown by both getOption() and setOption() methods.
|
||||
* @run main UnsupportedOptionsTest
|
||||
* @run main/othervm -limitmods java.base UnsupportedOptionsTest
|
||||
* @run main/othervm --limit-modules=java.base UnsupportedOptionsTest
|
||||
*/
|
||||
|
||||
public class UnsupportedOptionsTest {
|
||||
|
@ -29,12 +29,12 @@
|
||||
* @compile/module=java.httpclient sun/net/httpclient/hpack/SpecHelper.java
|
||||
* @compile/module=java.httpclient sun/net/httpclient/hpack/TestHelper.java
|
||||
* @compile/module=java.httpclient sun/net/httpclient/hpack/BuffersTestingKit.java
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.BinaryPrimitivesTest
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.CircularBufferTest
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.DecoderTest
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.EncoderTest
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.HeaderTableTest
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.HuffmanTest
|
||||
* @run testng/othervm -XaddReads:java.httpclient=ALL-UNNAMED java.httpclient/sun.net.httpclient.hpack.TestHelper
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.BinaryPrimitivesTest
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.CircularBufferTest
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.DecoderTest
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.EncoderTest
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.HeaderTableTest
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.HuffmanTest
|
||||
* @run testng/othervm java.httpclient/sun.net.httpclient.hpack.TestHelper
|
||||
*/
|
||||
public class HpackDriver { }
|
||||
|
@ -25,7 +25,7 @@
|
||||
* @bug 4640544 8044773
|
||||
* @summary Unit test for setOption/getOption/options methods
|
||||
* @run main SocketOptionTests
|
||||
* @run main/othervm -limitmods java.base SocketOptionTests
|
||||
* @run main/othervm --limit-modules=java.base SocketOptionTests
|
||||
*/
|
||||
|
||||
import java.nio.*;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @summary Unit test for ServerSocketChannel setOption/getOption/options
|
||||
* methods.
|
||||
* @run main SocketOptionTests
|
||||
* @run main/othervm -limitmods java.base SocketOptionTests
|
||||
* @run main/othervm --limit-modules=java.base SocketOptionTests
|
||||
*/
|
||||
|
||||
import java.nio.*;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @summary Unit test to check SocketChannel setOption/getOption/options
|
||||
* methods.
|
||||
* @run main SocketOptionTests
|
||||
* @run main/othervm -limitmods java.base SocketOptionTests
|
||||
* @run main/othervm --limit-modules=java.base SocketOptionTests
|
||||
*/
|
||||
|
||||
import java.nio.*;
|
||||
|
@ -109,7 +109,7 @@ failures=0
|
||||
|
||||
go() {
|
||||
echo ''
|
||||
sh -xc "$JAVA ${TESTVMOPTS} -XaddExports:java.base/sun.nio.ch=ALL-UNNAMED $DFLAG \
|
||||
sh -xc "$JAVA ${TESTVMOPTS} --add-exports java.base/sun.nio.ch=ALL-UNNAMED $DFLAG \
|
||||
$1 $2 $3 $4 $5 $6 $7 $8" 2>&1
|
||||
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ mkdir -p ext
|
||||
$COMPILEJAVA/bin/jar ${TESTTOOLVMOPTS} cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class
|
||||
|
||||
TESTVMOPTS="${TESTVMOPTS} \
|
||||
-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED \
|
||||
-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED \
|
||||
-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED \
|
||||
-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
|
||||
--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED \
|
||||
--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED \
|
||||
--add-exports java.rmi/sun.rmi.transport=ALL-UNNAMED \
|
||||
--add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
|
||||
$TESTJAVA/bin/java ${TESTVMOPTS} -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest
|
||||
|
||||
|
11
jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
11
jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, 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
|
||||
@ -24,7 +24,6 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4510355
|
||||
* @key intermittent
|
||||
* @summary ActivationGroup implementations cannot be downloaded by default;
|
||||
* Creates a custom activation group without setting a security manager
|
||||
* in activation group's descriptor. The custom activation group
|
||||
@ -140,10 +139,10 @@ public class DownloadActivationGroup
|
||||
CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(
|
||||
null,
|
||||
new String[] {
|
||||
"-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
|
||||
"--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
|
||||
|
||||
ActivationGroupDesc groupDesc =
|
||||
new ActivationGroupDesc("MyActivationGroupImpl",
|
||||
|
@ -121,11 +121,11 @@ public class StubClassesPermitted
|
||||
System.err.println("Create activation group, in a new VM");
|
||||
CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(null,
|
||||
new String[] {
|
||||
"-XaddExports:java.base/sun.security.provider=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED",
|
||||
"-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
|
||||
"--add-exports=java.base/sun.security.provider=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED",
|
||||
"--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
|
||||
|
||||
ActivationGroupDesc groupDesc =
|
||||
new ActivationGroupDesc(p, cmd);
|
||||
|
@ -106,7 +106,7 @@ public class InheritedChannelNotServerSocket {
|
||||
rmid = RMID.createRMID(System.out, System.err, true, true,
|
||||
TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
|
||||
rmid.addOptions(
|
||||
"-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"-Djava.nio.channels.spi.SelectorProvider=InheritedChannelNotServerSocket$SP");
|
||||
rmid.start();
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class RmidViaInheritedChannel implements Callback {
|
||||
rmid = RMID.createRMID(System.out, System.err, true, false,
|
||||
TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
|
||||
rmid.addOptions(
|
||||
"-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
|
||||
"-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider");
|
||||
if (System.getProperty("os.name").startsWith("Windows") &&
|
||||
System.getProperty("os.version").startsWith("5."))
|
||||
|
@ -97,8 +97,8 @@ public class ModuleTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAllInModule() throws Exception {
|
||||
assertEquals(executeTestJava("-mp", pathJoin(MTEST_JAR, CLIENT_JAR, SERVER_JAR),
|
||||
"-addmods", "mclient,mserver",
|
||||
assertEquals(executeTestJava("--module-path", pathJoin(MTEST_JAR, CLIENT_JAR, SERVER_JAR),
|
||||
"--add-modules", "mclient,mserver",
|
||||
"-m", "mtest/" + DUMMY_MAIN)
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out)
|
||||
@ -113,7 +113,7 @@ public class ModuleTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAppInModule() throws Exception {
|
||||
assertEquals(executeTestJava("-mp", MTEST_JAR,
|
||||
assertEquals(executeTestJava("--module-path", MTEST_JAR,
|
||||
"-cp", pathJoin(CLIENT_JAR, SERVER_JAR),
|
||||
"-m", "mtest/" + DUMMY_MAIN)
|
||||
.outputTo(System.out)
|
||||
@ -129,8 +129,8 @@ public class ModuleTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAppInUnnamedModule() throws Exception {
|
||||
assertEquals(executeTestJava("-mp", pathJoin(CLIENT_JAR, SERVER_JAR),
|
||||
"-addmods", "mclient,mserver",
|
||||
assertEquals(executeTestJava("--module-path", pathJoin(CLIENT_JAR, SERVER_JAR),
|
||||
"--add-modules", "mclient,mserver",
|
||||
"-cp", MTEST_JAR,
|
||||
DUMMY_MAIN)
|
||||
.outputTo(System.out)
|
||||
@ -146,8 +146,8 @@ public class ModuleTest {
|
||||
*/
|
||||
@Test
|
||||
public void testClientInUnamedModule() throws Exception {
|
||||
assertEquals(executeTestJava("-mp", pathJoin(MTEST_JAR, SERVER_JAR),
|
||||
"-addmods", "mserver",
|
||||
assertEquals(executeTestJava("--module-path", pathJoin(MTEST_JAR, SERVER_JAR),
|
||||
"--add-modules", "mserver",
|
||||
"-cp", CLIENT_JAR,
|
||||
"-m", "mtest/" + DUMMY_MAIN)
|
||||
.outputTo(System.out)
|
||||
|
@ -99,10 +99,10 @@ case "$OS" in
|
||||
esac
|
||||
# trailing / after code base is important for rmi codebase property.
|
||||
TESTVMOPTS="${TESTVMOPTS} \
|
||||
-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED \
|
||||
-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED \
|
||||
-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED \
|
||||
-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
|
||||
--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED \
|
||||
--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED \
|
||||
--add-exports java.rmi/sun.rmi.transport=ALL-UNNAMED \
|
||||
--add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
|
||||
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH ${ARGS} -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 &
|
||||
TEST_PID=$!
|
||||
#bulk of testcase - let it run for a while
|
||||
|
@ -123,10 +123,10 @@ public class CheckFQDN extends UnicastRemoteObject
|
||||
propOption + property +
|
||||
equal +
|
||||
propertyValue + extraProp +
|
||||
" -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED" +
|
||||
" -XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED" +
|
||||
" -XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED" +
|
||||
" -XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
|
||||
" --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED" +
|
||||
" --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED" +
|
||||
" --add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED" +
|
||||
" --add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
|
||||
" -Drmi.registry.port=" +
|
||||
REGISTRY_PORT,
|
||||
"");
|
||||
|
@ -75,10 +75,10 @@ public class DGCDeadLock implements Runnable {
|
||||
try {
|
||||
String options = " -Djava.security.policy=" +
|
||||
TestParams.defaultPolicy +
|
||||
" -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED" +
|
||||
" -XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED" +
|
||||
" -XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED" +
|
||||
" -XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
|
||||
" --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED" +
|
||||
" --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED" +
|
||||
" --add-exports java.rmi/sun.rmi.transport=ALL-UNNAMED" +
|
||||
" --add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
|
||||
" -Djava.rmi.dgc.leaseValue=500000" +
|
||||
" -Dsun.rmi.dgc.checkInterval=" +
|
||||
(HOLD_TARGET_TIME - 5000) +
|
||||
|
@ -317,7 +317,7 @@ public class SecurityProviderModularTest extends ModularTest {
|
||||
vmArgs.put("-Duser.language=", "en");
|
||||
vmArgs.put("-Duser.region=", "US");
|
||||
if (addModName != null && sModuletype == MODULE_TYPE.AUTO) {
|
||||
vmArgs.put("-addmods ", addModName);
|
||||
vmArgs.put("--add-modules=", addModName);
|
||||
}
|
||||
// If mechanism selected to find the provider through
|
||||
// Security.getProvider() then use providerName/ProviderClassName based
|
||||
|
@ -137,7 +137,7 @@ public abstract class ModularTest {
|
||||
final StringJoiner command = new StringJoiner(SPACE, SPACE, SPACE);
|
||||
vmArgs.forEach((key, value) -> command.add(key + value));
|
||||
if (modulePath != null) {
|
||||
command.add("-mp").add(modulePath.toFile().getCanonicalPath());
|
||||
command.add("--module-path").add(modulePath.toFile().getCanonicalPath());
|
||||
}
|
||||
if (classPath != null && classPath.length() > 0) {
|
||||
command.add("-cp").add(classPath);
|
||||
|
@ -25,19 +25,19 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.Permission;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* This is a test library that makes writing a Java test that spawns multiple
|
||||
@ -184,12 +184,9 @@ public class Proc {
|
||||
"java").getPath());
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
String addexports;
|
||||
while ((addexports = System.getProperty("jdk.launcher.addexports." + n)) != null) {
|
||||
prop("jdk.launcher.addexports." + n, addexports);
|
||||
n++;
|
||||
}
|
||||
Stream.of(jdk.internal.misc.VM.getRuntimeArguments())
|
||||
.filter(arg -> arg.startsWith("--add-exports="))
|
||||
.forEach(cmd::add);
|
||||
|
||||
Collections.addAll(cmd, splitProperty("test.vm.opts"));
|
||||
Collections.addAll(cmd, splitProperty("test.java.opts"));
|
||||
|
@ -31,7 +31,7 @@
|
||||
# This test is locale data-dependent and assumes that both JRE and CLDR
|
||||
# have the same geneic time zone names in English.
|
||||
|
||||
EXTRAOPTS="-XaddExports:java.base/sun.util.locale.provider=ALL-UNNAMED"
|
||||
EXTRAOPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED"
|
||||
STATUS=0
|
||||
echo "Locale providers: default"
|
||||
if ! ${TESTJAVA}/bin/java -esa ${TESTVMOPTS} ${EXTRAOPTS} -cp "${TESTCLASSES}" GenericTimeZoneNamesTest en-US; then
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#
|
||||
|
||||
EXTRAOPTS="-XaddExports:java.base/jdk.internal.math=ALL-UNNAMED"
|
||||
EXTRAOPTS="--add-exports java.base/jdk.internal.math=ALL-UNNAMED"
|
||||
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -cp ${TESTSRC} -d . \
|
||||
${TESTSRC}/Basic.java
|
||||
|
||||
|
@ -122,8 +122,8 @@ tznp
|
||||
tznp8013086
|
||||
EOF
|
||||
|
||||
EXTRAOPTS="-XaddExports:java.base/sun.util.locale=ALL-UNNAMED \
|
||||
-XaddExports:java.base/sun.util.locale.provider=ALL-UNNAMED"
|
||||
EXTRAOPTS="--add-exports java.base/sun.util.locale=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED"
|
||||
|
||||
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${SPIDIR}${FS}dest \
|
||||
${SPIDIR}${FS}src${FS}tznp.java \
|
||||
|
@ -93,8 +93,8 @@ case "$1" in
|
||||
esac
|
||||
|
||||
|
||||
EXTRA_OPTS="-XaddExports:java.base/sun.util.locale.provider=ALL-UNNAMED \
|
||||
-XaddExports:java.base/sun.util.resources=ALL-UNNAMED"
|
||||
EXTRA_OPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.util.resources=ALL-UNNAMED"
|
||||
|
||||
# compile
|
||||
cp ${TESTSRC}${FS}ProviderTest.java .
|
||||
|
@ -68,7 +68,7 @@ cd ${PATCHDIR}/java.desktop
|
||||
${TESTJAVA}/bin/jar xf ${TESTSRC}/awtres.jar
|
||||
|
||||
echo
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -Xpatch:java.desktop=${PATCHDIR}/java.desktop \
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} --patch-module java.desktop=${PATCHDIR}/java.desktop \
|
||||
-cp ${TESTCLASSES} Bug6299235Test
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
|
@ -47,7 +47,7 @@ do
|
||||
mkdir -p mods/$B
|
||||
CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
|
||||
if [ "x$CLASSES" != x ]; then
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src -cp mods/test $CLASSES
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src -cp mods/test $CLASSES
|
||||
fi
|
||||
PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
|
||||
if [ "x$PROPS" != x ]; then
|
||||
@ -61,8 +61,8 @@ do
|
||||
done
|
||||
|
||||
mkdir -p mods/test
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
|
||||
|
||||
$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
|
||||
exit $?
|
||||
|
@ -47,7 +47,7 @@ do
|
||||
mkdir -p mods/$B
|
||||
CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
|
||||
if [ "x$CLASSES" != x ]; then
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src -cp mods/test $CLASSES
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src -cp mods/test $CLASSES
|
||||
fi
|
||||
PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
|
||||
if [ "x$PROPS" != x ]; then
|
||||
@ -61,8 +61,8 @@ do
|
||||
done
|
||||
|
||||
mkdir -p mods/test
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
|
||||
|
||||
$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
|
||||
exit $?
|
||||
|
@ -52,7 +52,7 @@ do
|
||||
mkdir -p mods/$B
|
||||
CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
|
||||
if [ "x$CLASSES" != x ]; then
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src $CP $CLASSES
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src $CP $CLASSES
|
||||
fi
|
||||
PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
|
||||
if [ "x$PROPS" != x ]; then
|
||||
@ -67,7 +67,7 @@ do
|
||||
done
|
||||
|
||||
mkdir -p mods/test
|
||||
$JAVAC -g -cp mods/mainbundles -d mods -modulesourcepath $TESTSRC/src \
|
||||
$JAVAC -g -cp mods/mainbundles -d mods --module-source-path $TESTSRC/src \
|
||||
`find $TESTSRC/src/test -name "*.java"`
|
||||
|
||||
# Create a jar to be added to the class path. Expected only properties files are
|
||||
@ -81,9 +81,9 @@ $JAR -cf extra.jar -C classes jdk/test/resources/eu \
|
||||
STATUS=0
|
||||
|
||||
echo "jdk.test.Main should load bundles using ResourceBundleProviders."
|
||||
$JAVA -mp mods -m test/jdk.test.Main de fr ja ja-jp zh-tw en de ja-jp || STATUS=1
|
||||
$JAVA -p mods -m test/jdk.test.Main de fr ja ja-jp zh-tw en de ja-jp || STATUS=1
|
||||
|
||||
echo "jdk.test.Main should NOT load bundles from the jar file specified by the class-path."
|
||||
$JAVA -cp extra.jar -mp mods -m test/jdk.test.Main es vi && STATUS=1
|
||||
$JAVA -cp extra.jar -p mods -m test/jdk.test.Main es vi && STATUS=1
|
||||
|
||||
exit $STATUS
|
||||
|
@ -57,7 +57,7 @@ if [ "x$PROPS" != x ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src \
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src \
|
||||
-cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
|
||||
|
||||
# Create a jar to be added to the class path. Expected properties files are
|
||||
@ -69,9 +69,9 @@ $JAR -cf extra.jar -C $TESTSRC/src/extra jdk/test/resources
|
||||
STATUS=0
|
||||
|
||||
echo 'jdk.test.Main should load bundles local to named module "test".'
|
||||
$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de || STATUS=1
|
||||
$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de || STATUS=1
|
||||
|
||||
echo "jdk.test.Main should NOT load bundles from the jar file specified by the class-path."
|
||||
$JAVA -cp extra.jar -mp mods -m test/jdk.test.Main vi && STATUS=1
|
||||
$JAVA -cp extra.jar -p mods -m test/jdk.test.Main vi && STATUS=1
|
||||
|
||||
exit $STATUS
|
||||
|
@ -59,7 +59,7 @@ public class TestPermission {
|
||||
public void compileAll() throws Exception {
|
||||
for (String mn : modules) {
|
||||
Path msrc = SRC_DIR.resolve(mn);
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "-modulesourcepath", SRC_DIR.toString()));
|
||||
assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class TestPermission {
|
||||
*/
|
||||
@Test
|
||||
public void runTest() throws Exception {
|
||||
int exitValue = executeTestJava("-mp", MODS_DIR.toString(),
|
||||
int exitValue = executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"-m", "test/jdk.test.Main")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out)
|
||||
|
@ -50,7 +50,7 @@ B=bundles
|
||||
mkdir -p mods/$B
|
||||
CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
|
||||
if [ "x$CLASSES" != x ]; then
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src $CLASSES
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
|
||||
fi
|
||||
PROPS="`(cd $TESTSRC/src/$B; find . -name '*.properties')`"
|
||||
if [ "x$PROPS" != x ]; then
|
||||
@ -62,9 +62,9 @@ if [ "x$PROPS" != x ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src \
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src \
|
||||
-cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
|
||||
|
||||
$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
|
||||
exit $?
|
||||
|
@ -57,7 +57,7 @@ do
|
||||
mkdir -p mods/$M
|
||||
CLASSES="`find $TESTSRC/src/$M -name '*.java'`"
|
||||
if [ "x$CLASSES" != x ]; then
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src $CLASSES
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
|
||||
fi
|
||||
PROPS="`(cd $TESTSRC/src/$M; find . -name '*.properties')`"
|
||||
if [ "x$PROPS" != x ]; then
|
||||
@ -96,23 +96,23 @@ done
|
||||
|
||||
# jdk.test.resources.{classes,props}.* are available only to named module "test"
|
||||
# by ResourceBundleProvider.
|
||||
runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.classes.MyResources true
|
||||
runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.props.MyResources true
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.classes.MyResources false
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.props.MyResources false
|
||||
|
||||
# Add mods/named.bundles to the class path.
|
||||
runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.classes.MyResources true
|
||||
runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.props.MyResources true
|
||||
runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.classes.MyResources false
|
||||
runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.props.MyResources false
|
||||
|
||||
# Tests using jdk.test.TestWithUnnamedModuleArg and jdk.embargo.TestWithUnnamedModuleArg
|
||||
@ -120,37 +120,37 @@ runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleA
|
||||
|
||||
# jdk.test.resources.classes is exported to named module "test".
|
||||
# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
|
||||
runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.classes.MyResources false
|
||||
|
||||
# jdk.test.resources.props is exported to named module "test".
|
||||
# loader.getResource() doesn't find jdk.test.resources.props.MyResources.
|
||||
runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.props.MyResources false
|
||||
|
||||
# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.classes.MyResources false
|
||||
# jdk.test.resources.props is exported to named module "test".
|
||||
# loader.getResource() doesn't find jdk.test.resources.props.MyResources.
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.props.MyResources false
|
||||
|
||||
# Add mods/named.bundles to the class path
|
||||
|
||||
# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
|
||||
runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.classes.MyResources false
|
||||
# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
|
||||
runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.props.MyResources true
|
||||
|
||||
# jdk.test.resources.exported.classes.MyResources is treated
|
||||
# as if the class is in an unnamed module.
|
||||
runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.classes.MyResources true
|
||||
# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
|
||||
runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.props.MyResources true
|
||||
|
||||
#################################################
|
||||
@ -160,23 +160,23 @@ runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedMo
|
||||
# neither of which specifies an unnamed module with ResourceBundle.getBundle.
|
||||
|
||||
# None of jdk.test.resources.exported.** is available to the named modules.
|
||||
runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources false
|
||||
runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources false
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources false
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources false
|
||||
|
||||
# Add mods/exported.named.bundles to the class path.
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources false
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources false
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources false
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithNoModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources false
|
||||
|
||||
# Tests using jdk.test.TestWithUnnamedModuleArg and jdk.embargo.TestWithUnnamedModuleArg
|
||||
@ -184,36 +184,36 @@ runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWith
|
||||
|
||||
# loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
|
||||
# and throws a ClassNotFoundException.
|
||||
runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources false
|
||||
# The properties files in jdk.test.resources.exported.props are not found with loader.getResource().
|
||||
runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources false
|
||||
|
||||
|
||||
# loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
|
||||
# and throws a ClassNotFoundException.
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources false
|
||||
# The properties files in jdk.test.resources.exported.props are not found
|
||||
# with loader.getResource().
|
||||
runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources false
|
||||
|
||||
# Add mods/exported.named.bundles to the class path.
|
||||
|
||||
# jdk.test.resources.exported.classes.MyResources.getModule().isNamed() returns false.
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources true
|
||||
# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m test/jdk.test.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources true
|
||||
|
||||
# jdk.test.resources.exported.classes.MyResources.getModule().isNamed() returns false.
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.classes.MyResources true
|
||||
# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
|
||||
runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
runJava -cp mods/exported.named.bundles -p mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
|
||||
jdk.test.resources.exported.props.MyResources true
|
||||
|
||||
#######################################
|
||||
|
@ -48,7 +48,7 @@ B=bundles
|
||||
mkdir -p mods/$B
|
||||
CLASSES="`find $TESTSRC/src/$B -name '*.java'`"
|
||||
if [ "x$CLASSES" != x ]; then
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src $CLASSES
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src $CLASSES
|
||||
fi
|
||||
PROPS="`(cd $TESTSRC/src/$B; find . -name '*.xml')`"
|
||||
if [ "x$PROPS" != x ]; then
|
||||
@ -60,9 +60,9 @@ if [ "x$PROPS" != x ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
$JAVAC -g -d mods -modulesourcepath $TESTSRC/src \
|
||||
$JAVAC -g -d mods --module-source-path $TESTSRC/src \
|
||||
-cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
|
||||
|
||||
$JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
$JAVA -p mods -m test/jdk.test.Main de fr ja zh-tw en de
|
||||
|
||||
exit $?
|
||||
|
@ -105,13 +105,13 @@ public class ServicesTest {
|
||||
|
||||
|
||||
/**
|
||||
* Run test with -modulepath.
|
||||
* Run test with --module-path.
|
||||
*
|
||||
* BananaScriptEngine should be found.
|
||||
*/
|
||||
public void runWithModulePath() throws Exception {
|
||||
int exitValue
|
||||
= executeTestJava("-mp", MODS_DIR.toString(),
|
||||
= executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"-m", "test/test.Main",
|
||||
"BananaScriptEngine")
|
||||
.outputTo(System.out)
|
||||
@ -123,13 +123,13 @@ public class ServicesTest {
|
||||
|
||||
|
||||
/**
|
||||
* Run test with -modulepath and -classpath.
|
||||
* Run test with --module-path and -classpath.
|
||||
*
|
||||
* Both BananaScriptEngine and PearScriptEngine should be found
|
||||
*/
|
||||
public void runWithModulePathAndClassPath() throws Exception {
|
||||
int exitValue
|
||||
= executeTestJava("-mp", MODS_DIR.toString(),
|
||||
= executeTestJava("--module-path", MODS_DIR.toString(),
|
||||
"-cp", CLASSES_DIR.toString(),
|
||||
"-m", "test/test.Main",
|
||||
"BananaScriptEngine", "PearScriptEngine")
|
||||
|
@ -66,10 +66,10 @@ public class GetResourceBundleTest {
|
||||
for (String mn : modules) {
|
||||
Path msrc = MOD_SRC_DIR.resolve(mn);
|
||||
assertTrue(CompilerUtils.compile(msrc, MOD_DEST_DIR,
|
||||
"-modulesourcepath", MOD_SRC_DIR.toString()));
|
||||
"--module-source-path", MOD_SRC_DIR.toString()));
|
||||
}
|
||||
assertTrue(CompilerUtils.compile(PKG_SRC_DIR, PKG_DEST_DIR,
|
||||
"-modulepath", MOD_DEST_DIR.toString(), "-addmods", String.join(",", modules)));
|
||||
"--module-path", MOD_DEST_DIR.toString(), "--add-modules", String.join(",", modules)));
|
||||
|
||||
// copy resource files
|
||||
String[] files = { "m1/p1/resource/p.properties", "m2/p2/resource/p.properties" };
|
||||
@ -84,8 +84,8 @@ public class GetResourceBundleTest {
|
||||
public void runWithoutSecurityManager() throws Exception {
|
||||
int exitValue = executeTestJava(
|
||||
"-cp", PKG_DEST_DIR.toString(),
|
||||
"-mp", MOD_DEST_DIR.toString(),
|
||||
"-addmods", String.join(",", modules),
|
||||
"--module-path", MOD_DEST_DIR.toString(),
|
||||
"--add-modules", String.join(",", modules),
|
||||
"p3.test.ResourceBundleTest")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.err)
|
||||
@ -98,8 +98,8 @@ public class GetResourceBundleTest {
|
||||
int exitValue = executeTestJava(
|
||||
"-Djava.security.manager",
|
||||
"-cp", PKG_DEST_DIR.toString(),
|
||||
"-mp", MOD_DEST_DIR.toString(),
|
||||
"-addmods", String.join(",", modules),
|
||||
"--module-path", MOD_DEST_DIR.toString(),
|
||||
"--add-modules", String.join(",", modules),
|
||||
"p3.test.ResourceBundleTest")
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.err)
|
||||
|
@ -27,8 +27,8 @@
|
||||
* @summary Make sure Cipher IO streams doesn't call extra doFinal if close()
|
||||
* is called multiple times. Additionally, verify the input and output streams
|
||||
* match with encryption and decryption with non-stream crypto.
|
||||
* @compile -addmods java.xml.bind CipherStreamClose.java
|
||||
* @run main/othervm -addmods java.xml.bind CipherStreamClose
|
||||
* @modules java.xml.bind
|
||||
* @run main CipherStreamClose
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user