@@ -67,32 +67,13 @@ public static List<String> parseArgsFromEnvVar(String envVarValue, String envVar
67
67
boolean isArgFileOption = argument .startsWith ("@" ) && !argument .startsWith ("@@" );
68
68
if (isArgFileOption || isTerminalOpt (argument )) {
69
69
throw errorFunction .apply ("Option '" + argument + "' is not allowed in environment variable " + envVarName );
70
- } else if (!isExpectingNoDashArg (argument , result )) {
71
- throw errorFunction .apply ("Cannot specify main class in environment variable " + envVarName );
72
70
}
73
71
result .add (argument );
74
72
assert i >= envVarValueLength || isspace (envVarValue .charAt (i ));
75
73
}
76
74
return result ;
77
75
}
78
76
79
- private static boolean isExpectingNoDashArg (String argument , List <String > previousArgs ) {
80
- if (argument .startsWith ("-" )) {
81
- return true ; // Ignore dash args
82
- }
83
- if (previousArgs .isEmpty ()) {
84
- return false ; // No previous arg means the no-dash arg is unexpected
85
- }
86
- String previousArg = previousArgs .getLast ();
87
- // Derivation from port: unpack any flags for JVM running the image generator
88
- previousArg = previousArg .startsWith ("-J" ) ? previousArg .substring (2 ) : previousArg ;
89
- boolean expectingNoDashArg = isWhiteSpaceOption (previousArg );
90
- if ("-jar" .equals (previousArg ) || "--module" .equals (previousArg ) || "-m" .equals (previousArg )) {
91
- expectingNoDashArg = false ;
92
- }
93
- return expectingNoDashArg ;
94
- }
95
-
96
77
public static boolean isspace (char value ) {
97
78
// \v not supported in Java
98
79
return value == ' ' || value == '\f' || value == '\n' || value == '\r' || value == '\t' ;
0 commit comments