author | ksrini |
Wed, 15 Feb 2017 18:07:28 -0800 | |
changeset 43874 | d49715456f51 |
permissions | -rw-r--r-- |
43874
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
1 |
/* |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
4 |
* |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
8 |
* |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
13 |
* accompanied this code). |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
14 |
* |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
18 |
* |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
21 |
* questions. |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
22 |
*/ |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
23 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
24 |
/* |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
25 |
* @test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
26 |
* @bug 8173308 |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
27 |
* @summary Check JDK_JAVA_OPTIONS parsing behavior |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
28 |
* @library /tools/lib |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
29 |
* @modules jdk.compiler/com.sun.tools.javac.main |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
30 |
* @build toolbox.ToolBox toolbox.TestRunner |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
31 |
* @run main EnvVariableTest |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
32 |
*/ |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
33 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
34 |
import java.io.ByteArrayOutputStream; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
35 |
import java.io.IOException; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
36 |
import java.io.PrintStream; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
37 |
import java.nio.file.Path; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
38 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
39 |
import toolbox.*; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
40 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
41 |
import com.sun.tools.javac.main.CommandLine; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
42 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
43 |
public class EnvVariableTest extends TestRunner { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
44 |
final String testClasses; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
45 |
final ToolBox tb; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
46 |
final Path javaExePath; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
47 |
final ExecTask task; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
48 |
final PrintStream ostream; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
49 |
final ByteArrayOutputStream baos; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
50 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
51 |
public EnvVariableTest() { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
52 |
super(System.err); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
53 |
ostream = System.err; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
54 |
baos = new ByteArrayOutputStream(); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
55 |
testClasses = System.getProperty("test.classes"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
56 |
tb = new ToolBox(); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
57 |
javaExePath = tb.getJDKTool("java"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
58 |
task = new ExecTask(tb, javaExePath); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
59 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
60 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
61 |
public static void main(String... args) throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
62 |
EnvVariableTest t = new EnvVariableTest(); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
63 |
t.runTests(); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
64 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
65 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
66 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
67 |
public void testDoubleQuote() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
68 |
// white space quoted with double quotes |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
69 |
test("-version -cp \"c:\\\\java libs\\\\one.jar\" \n", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
70 |
"-version", "-cp", "c:\\\\java libs\\\\one.jar"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
71 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
72 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
73 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
74 |
public void testSingleQuote() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
75 |
// white space quoted with single quotes |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
76 |
test("-version -cp \'c:\\\\java libs\\\\one.jar\' \n", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
77 |
"-version", "-cp", "c:\\\\java libs\\\\one.jar"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
78 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
79 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
80 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
81 |
public void testEscapeCharacters() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
82 |
// escaped characters |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
83 |
test("escaped chars testing \"\\a\\b\\c\\f\\n\\r\\t\\v\\9\\6\\23\\82\\28\\377\\477\\278\\287\"", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
84 |
"escaped", "chars", "testing", "\\a\\b\\c\\f\\n\\r\\t\\v\\9\\6\\23\\82\\28\\377\\477\\278\\287"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
85 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
86 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
87 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
88 |
public void testMixedQuotes() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
89 |
// more mixing of quote types |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
90 |
test("\"mix 'single quote' in double\" 'mix \"double quote\" in single' partial\"quote me\"this", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
91 |
"mix 'single quote' in double", "mix \"double quote\" in single", "partialquote methis"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
92 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
93 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
94 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
95 |
public void testWhiteSpaces() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
96 |
// whitespace tests |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
97 |
test("line one #comment\n'line #2' #rest are comment\r\n#comment on line 3\fline 4 #comment to eof", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
98 |
"line", "one", "#comment", "line #2", "#rest", "are", "comment", "#comment", "on", "line", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
99 |
"3", "line", "4", "#comment", "to", "eof"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
100 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
101 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
102 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
103 |
public void testMismatchedDoubleQuote() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
104 |
// mismatched quote |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
105 |
test("This is an \"open quote \n across line\n\t, note for WS.", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
106 |
"Exception: JDK_JAVAC_OPTIONS"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
107 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
108 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
109 |
@Test |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
110 |
public void testMismatchedSingleQuote() throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
111 |
// mismatched quote |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
112 |
test("This is an \'open quote \n across line\n\t, note for WS.", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
113 |
"Exception: JDK_JAVAC_OPTIONS"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
114 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
115 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
116 |
void test(String full, String... expectedArgs) throws Exception { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
117 |
task.envVar("JDK_JAVAC_OPTIONS", full); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
118 |
task.args("--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
119 |
"-cp", testClasses, "EnvVariableTest$Tester"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
120 |
Task.Result tr = task.run(Task.Expect.SUCCESS); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
121 |
String expected = Tester.arrayToString(expectedArgs); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
122 |
String in = tr.getOutput(Task.OutputKind.STDOUT); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
123 |
System.err.println("Matching..."); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
124 |
System.err.println("Obtained: " + in); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
125 |
System.err.println("Expected: " + expected); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
126 |
if (in.contains(expected)) { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
127 |
System.err.println("....OK"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
128 |
return; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
129 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
130 |
throw new Exception("Expected strings not found"); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
131 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
132 |
|
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
133 |
/** |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
134 |
* A tester class that is invoked to invoke the CommandLine class, and |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
135 |
* print the result. |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
136 |
*/ |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
137 |
public static class Tester { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
138 |
private static final String[] EMPTY_ARRAY = new String[0]; |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
139 |
static String arrayToString(String... args) { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
140 |
return String.join(", ", args); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
141 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
142 |
public static void main(String... args) throws IOException { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
143 |
try { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
144 |
String[] argv = CommandLine.parse("JDK_JAVAC_OPTIONS", EMPTY_ARRAY); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
145 |
System.out.print(arrayToString(argv)); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
146 |
} catch (CommandLine.UnmatchedQuote ex) { |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
147 |
System.out.print("Exception: " + ex.variableName); |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
148 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
149 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
150 |
} |
d49715456f51
8173308: JAVAC_OPTIONS should be updated to align with JAVA_OPTIONS
ksrini
parents:
diff
changeset
|
151 |
} |