Issue #2191 - JPMS Support.

Code cleanups.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-09-26 13:36:51 +02:00
parent 7e68ef1e17
commit 587ecfeb9c
1 changed files with 20 additions and 54 deletions

View File

@ -416,8 +416,7 @@ public class StartArgs
return; return;
} }
List<String> sortedKeys = new ArrayList<>(); List<String> sortedKeys = new ArrayList<>(systemPropertySource.keySet());
sortedKeys.addAll(systemPropertySource.keySet());
Collections.sort(sortedKeys); Collections.sort(sortedKeys);
for (String key : sortedKeys) for (String key : sortedKeys)
@ -459,11 +458,8 @@ public class StartArgs
/** /**
* Expand any command line added {@code --lib} lib references. * Expand any command line added {@code --lib} lib references.
*
* @throws IOException
* if unable to expand the libraries
*/ */
public void expandSystemProperties() throws IOException public void expandSystemProperties()
{ {
StartLog.debug("Expanding System Properties"); StartLog.debug("Expanding System Properties");
@ -480,7 +476,7 @@ public class StartArgs
} }
/** /**
* Expand any command line added <code>--lib</code> lib references. * Expand any command line added {@code --lib} lib references.
* *
* @throws IOException * @throws IOException
* if unable to expand the libraries * if unable to expand the libraries
@ -665,7 +661,7 @@ public class StartArgs
cmd.addRawArg("-Djetty.home=" + baseHome.getHome()); cmd.addRawArg("-Djetty.home=" + baseHome.getHome());
cmd.addRawArg("-Djetty.base=" + baseHome.getBase()); cmd.addRawArg("-Djetty.base=" + baseHome.getBase());
for (String x : jvmArgs) for (String x : getJvmArgs())
{ {
if (x.startsWith("-D")) if (x.startsWith("-D"))
{ {
@ -717,37 +713,25 @@ public class StartArgs
cmd.addRawArg("--add-modules"); cmd.addRawArg("--add-modules");
cmd.addRawArg(String.join(",", jmodAdds)); cmd.addRawArg(String.join(",", jmodAdds));
} }
if (!jmodPatch.isEmpty()) for (Map.Entry<String, Set<String>> entry : jmodPatch.entrySet())
{ {
for (Map.Entry<String, Set<String>> entry : jmodPatch.entrySet()) cmd.addRawArg("--patch-module");
{ cmd.addRawArg(entry.getKey() + "=" + String.join(File.pathSeparator, entry.getValue()));
cmd.addRawArg("--patch-module");
cmd.addRawArg(entry.getKey() + "=" + String.join(File.pathSeparator, entry.getValue()));
}
} }
if (!jmodOpens.isEmpty()) for (Map.Entry<String, Set<String>> entry : jmodOpens.entrySet())
{ {
for (Map.Entry<String, Set<String>> entry : jmodOpens.entrySet()) cmd.addRawArg("--add-opens");
{ cmd.addRawArg(entry.getKey() + "=" + String.join(",", entry.getValue()));
cmd.addRawArg("--add-opens");
cmd.addRawArg(entry.getKey() + "=" + String.join(",", entry.getValue()));
}
} }
if (!jmodExports.isEmpty()) for (Map.Entry<String, Set<String>> entry : jmodExports.entrySet())
{ {
for (Map.Entry<String, Set<String>> entry : jmodExports.entrySet()) cmd.addRawArg("--add-exports");
{ cmd.addRawArg(entry.getKey() + "=" + String.join(",", entry.getValue()));
cmd.addRawArg("--add-exports");
cmd.addRawArg(entry.getKey() + "=" + String.join(",", entry.getValue()));
}
} }
if (!jmodReads.isEmpty()) for (Map.Entry<String, Set<String>> entry : jmodReads.entrySet())
{ {
for (Map.Entry<String, Set<String>> entry : jmodReads.entrySet()) cmd.addRawArg("--add-reads");
{ cmd.addRawArg(entry.getKey() + "=" + String.join(",", entry.getValue()));
cmd.addRawArg("--add-reads");
cmd.addRawArg(entry.getKey() + "=" + String.join(",", entry.getValue()));
}
} }
cmd.addRawArg("--module"); cmd.addRawArg("--module");
@ -1241,10 +1225,7 @@ public class StartArgs
if (arg.startsWith("--skip-file-validation=")) if (arg.startsWith("--skip-file-validation="))
{ {
List<String> moduleNames = Props.getValues(arg); List<String> moduleNames = Props.getValues(arg);
for (String moduleName : moduleNames) skipFileValidationModules.addAll(moduleNames);
{
skipFileValidationModules.add(moduleName);
}
return; return;
} }
@ -1388,12 +1369,7 @@ public class StartArgs
for (String moduleName : moduleNames) for (String moduleName : moduleNames)
{ {
modules.add(moduleName); modules.add(moduleName);
List<String> list = sources.get(moduleName); List<String> list = sources.computeIfAbsent(moduleName, k -> new ArrayList<>());
if (list == null)
{
list = new ArrayList<>();
sources.put(moduleName,list);
}
list.add(source); list.add(source);
} }
} }
@ -1484,17 +1460,7 @@ public class StartArgs
@Override @Override
public String toString() public String toString()
{ {
StringBuilder builder = new StringBuilder(); return String.format("%s[enabledModules=%s, xmlRefs=%s, properties=%s, jvmArgs=%s]",
builder.append("StartArgs [enabledModules="); getClass().getSimpleName(), modules, xmlRefs, properties, jvmArgs);
builder.append(modules);
builder.append(", xmlRefs=");
builder.append(xmlRefs);
builder.append(", properties=");
builder.append(properties);
builder.append(", jvmArgs=");
builder.append(jvmArgs);
builder.append("]");
return builder.toString();
} }
} }