Skip to content

Commit f1419db

Browse files
committed
Cleanup RubyLauncher and update comment
1 parent 92b4cdd commit f1419db

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/launcher/java/org/truffleruby/launcher/RubyLauncher.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ protected String getMainClass() {
8787
return RubyLauncher.class.getName();
8888
}
8989

90-
@Override
91-
protected void validateArguments(Map<String, String> polyglotOptions) {
92-
}
93-
9490
@Override
9591
protected void printVersion() {
9692
getOutput().println(TruffleRuby.getVersionString(getImplementationNameFromEngine()));
@@ -131,10 +127,11 @@ protected List<String> preprocessArguments(List<String> args, Map<String, String
131127
if (config.readRubyOptEnv) {
132128
/* Calling processArguments() here will also add any unrecognized arguments such as
133129
* --jvm/--native/--vm.* arguments and polyglot options to `config.getUnknownArguments()`, which will
134-
* then be processed by AbstractLanguageLauncher and Launcher. If we are going to run Native, Launcher
135-
* will apply VM options to the current process. If we are going to run on JVM, Launcher will collect
136-
* them and pass them when execve()'ing to bin/java. Polyglot options are parsed by
137-
* AbstractLanguageLauncher in the final process. */
130+
* then be processed by AbstractLanguageLauncher. For VM arguments, #validateVmArguments() will be
131+
* called to check that the guessed --vm.* arguments match the actual ones (should always be the case,
132+
* except if --vm.* arguments are added dynamically like --vm.Xmn1g for gem/bundle on native). If they
133+
* do not match then the thin launcher will relaunch by execve(). Polyglot options are parsed by
134+
* AbstractLanguageLauncher#parseUnrecognizedOptions. */
138135
// Process RUBYOPT
139136
final List<String> rubyoptArgs = getArgsFromEnvVariable("RUBYOPT");
140137
new CommandLineParser(rubyoptArgs, config, false, true).processArguments();
@@ -382,7 +379,7 @@ private static List<String> getArgsFromEnvVariable(String name) {
382379
String value = System.getenv(name);
383380
if (value != null) {
384381
value = value.strip();
385-
if (value.length() != 0) {
382+
if (!value.isEmpty()) {
386383
return new ArrayList<>(Arrays.asList(value.split("\\s+")));
387384
}
388385
}
@@ -391,7 +388,7 @@ private static List<String> getArgsFromEnvVariable(String name) {
391388

392389
private static List<String> getPathListFromEnvVariable(String name) {
393390
final String value = System.getenv(name);
394-
if (value != null && value.length() != 0) {
391+
if (value != null && !value.isEmpty()) {
395392
return new ArrayList<>(Arrays.asList(value.split(":")));
396393
}
397394
return Collections.emptyList();

0 commit comments

Comments
 (0)