Skip to content

Commit fd6c9d4

Browse files
committed
Make it clear the CommandLineParser does not modify the passed arguments List
(cherry picked from commit 0f00dfb)
1 parent 1316edf commit fd6c9d4

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/launcher/java/org/truffleruby/launcher/CommandLineParser.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import java.util.HashMap;
4141
import java.util.List;
4242
import java.util.Map;
43-
import java.util.Objects;
4443
import java.util.function.BiConsumer;
4544
import java.util.logging.Handler;
4645
import java.util.logging.LogRecord;
@@ -62,19 +61,14 @@ public class CommandLineParser {
6261
private int lastInterpreterArgumentIndex;
6362
private int characterIndex;
6463

65-
public CommandLineParser(
66-
List<String> arguments,
67-
CommandLineOptions config,
68-
boolean processArgv,
69-
boolean rubyOpts) {
70-
64+
public CommandLineParser(List<String> arguments, CommandLineOptions config, boolean processArgv, boolean rubyOpts) {
7165
this.argumentIndex = 0;
7266
this.characterIndex = 0;
7367
this.lastInterpreterArgumentIndex = -1;
7468
this.config = config;
7569
this.processArgv = processArgv;
7670
this.rubyOpts = rubyOpts;
77-
this.arguments = Objects.requireNonNull(arguments);
71+
this.arguments = Collections.unmodifiableList(arguments);
7872
}
7973

8074
public void processArguments() throws CommandLineException {

0 commit comments

Comments
 (0)