Оптимизация списка JVM опций

This commit is contained in:
Gravit 2018-11-14 19:48:59 +07:00
parent ad924961e6
commit 4c4ff840d4
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -117,7 +117,7 @@ public int hashCode() {
private final BooleanConfigEntry useWhitelist; private final BooleanConfigEntry useWhitelist;
// Client launcher // Client launcher
private final StringConfigEntry mainClass; private final StringConfigEntry mainClass;
private final ListConfigEntry jvmArgs; private final List<String> jvmArgs= new ArrayList<>();
private final ListConfigEntry classPath; private final ListConfigEntry classPath;
private final ListConfigEntry clientArgs; private final ListConfigEntry clientArgs;
@ -150,7 +150,7 @@ public ClientProfile(BlockConfigEntry block) {
// Client launcher // Client launcher
mainClass = block.getEntry("mainClass", StringConfigEntry.class); mainClass = block.getEntry("mainClass", StringConfigEntry.class);
classPath = block.getEntry("classPath", ListConfigEntry.class); classPath = block.getEntry("classPath", ListConfigEntry.class);
jvmArgs = block.getEntry("jvmArgs", ListConfigEntry.class); block.getEntry("jvmArgs", ListConfigEntry.class).stream(StringConfigEntry.class).forEach(jvmArgs::add);
clientArgs = block.getEntry("clientArgs", ListConfigEntry.class); clientArgs = block.getEntry("clientArgs", ListConfigEntry.class);
whitelist = block.getEntry("whitelist", ListConfigEntry.class); whitelist = block.getEntry("whitelist", ListConfigEntry.class);
} }
@ -204,7 +204,7 @@ public FileNameMatcher getClientUpdateMatcher(/*boolean excludeOptional*/) {
@LauncherAPI @LauncherAPI
public String[] getJvmArgs() { public String[] getJvmArgs() {
return jvmArgs.stream(StringConfigEntry.class).toArray(String[]::new); return jvmArgs.toArray(new String[0]);
} }
@LauncherAPI @LauncherAPI
@ -309,7 +309,6 @@ public void verify() {
VerifyHelper.verifyInt(getServerPort(), VerifyHelper.range(0, 65535), "Illegal server port: " + getServerPort()); VerifyHelper.verifyInt(getServerPort(), VerifyHelper.range(0, 65535), "Illegal server port: " + getServerPort());
// Client launcher // Client launcher
jvmArgs.verifyOfType(ConfigEntry.Type.STRING);
classPath.verifyOfType(ConfigEntry.Type.STRING); classPath.verifyOfType(ConfigEntry.Type.STRING);
clientArgs.verifyOfType(ConfigEntry.Type.STRING); clientArgs.verifyOfType(ConfigEntry.Type.STRING);
VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty"); VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty");