author | jlahoda |
Tue, 11 Oct 2016 10:31:10 +0200 | |
changeset 41516 | 0a5838f027a4 |
parent 41254 | 08f8dbf7741e |
child 41931 | d7c9720c4223 |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
36526 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
41516
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
26 |
* @bug 8154283 8167320 |
36526 | 27 |
* @summary tests for multi-module mode compilation |
28 |
* @library /tools/lib |
|
29 |
* @modules |
|
30 |
* jdk.compiler/com.sun.tools.javac.api |
|
31 |
* jdk.compiler/com.sun.tools.javac.code |
|
32 |
* jdk.compiler/com.sun.tools.javac.main |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
33 |
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase |
36526 | 34 |
* @run main EdgeCases |
35 |
*/ |
|
36 |
||
37 |
import java.io.Writer; |
|
38 |
import java.nio.file.Files; |
|
39 |
import java.nio.file.Path; |
|
40 |
import java.nio.file.Paths; |
|
41 |
import java.util.Arrays; |
|
42 |
import java.util.HashSet; |
|
43 |
import java.util.List; |
|
44 |
import java.util.Objects; |
|
45 |
import java.util.Set; |
|
46 |
||
47 |
import javax.lang.model.element.Element; |
|
48 |
import javax.tools.JavaCompiler; |
|
49 |
import javax.tools.JavaFileObject; |
|
50 |
import javax.tools.StandardJavaFileManager; |
|
51 |
import javax.tools.ToolProvider; |
|
52 |
||
53 |
import com.sun.source.tree.CompilationUnitTree; |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
54 |
//import com.sun.source.util.JavacTask; // conflicts with toolbox.JavacTask |
36526 | 55 |
import com.sun.tools.javac.api.JavacTaskImpl; |
56 |
import com.sun.tools.javac.code.Symbol.ModuleSymbol; |
|
41516
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
57 |
import com.sun.tools.javac.code.Symtab; |
36526 | 58 |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
59 |
import toolbox.JarTask; |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
60 |
import toolbox.JavacTask; |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
61 |
import toolbox.Task; |
41254
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
62 |
import toolbox.Task.Expect; |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
63 |
import toolbox.Task.OutputKind; |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
64 |
|
36526 | 65 |
public class EdgeCases extends ModuleTestBase { |
66 |
||
67 |
public static void main(String... args) throws Exception { |
|
68 |
new EdgeCases().runTests(); |
|
69 |
} |
|
70 |
||
71 |
@Test |
|
37758 | 72 |
public void testAddExportUndefinedModule(Path base) throws Exception { |
36526 | 73 |
Path src = base.resolve("src"); |
74 |
tb.writeJavaFiles(src, "package test; import undef.Any; public class Test {}"); |
|
75 |
Path classes = base.resolve("classes"); |
|
76 |
tb.createDirectories(classes); |
|
77 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
78 |
List<String> log = new JavacTask(tb) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
79 |
.options("--add-exports", "undef/undef=ALL-UNNAMED", "-XDrawDiagnostics") |
36526 | 80 |
.outdir(classes) |
81 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
82 |
.run(Task.Expect.FAIL) |
36526 | 83 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
84 |
.getOutputLines(Task.OutputKind.DIRECT); |
36526 | 85 |
|
86 |
List<String> expected = Arrays.asList("- compiler.err.cant.find.module: undef", |
|
87 |
"Test.java:1:27: compiler.err.doesnt.exist: undef", |
|
88 |
"2 errors"); |
|
89 |
||
90 |
if (!expected.equals(log)) |
|
91 |
throw new Exception("expected output not found: " + log); |
|
92 |
} |
|
93 |
||
94 |
@Test |
|
37758 | 95 |
public void testModuleSymbolOutterMostClass(Path base) throws Exception { |
36526 | 96 |
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
97 |
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { |
|
98 |
Path moduleSrc = base.resolve("module-src"); |
|
99 |
Path m1 = moduleSrc.resolve("m1"); |
|
100 |
||
101 |
tb.writeJavaFiles(m1, "module m1 { }"); |
|
102 |
||
103 |
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(moduleSrc)); |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
104 |
com.sun.source.util.JavacTask task = |
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
105 |
(com.sun.source.util.JavacTask) compiler.getTask(null, fm, null, null, null, files); |
36526 | 106 |
|
107 |
task.analyze(); |
|
108 |
||
109 |
ModuleSymbol msym = (ModuleSymbol) task.getElements().getModuleElement("m1"); |
|
110 |
||
111 |
msym.outermostClass(); |
|
112 |
} |
|
113 |
} |
|
114 |
||
115 |
@Test |
|
37758 | 116 |
public void testParseEnterAnalyze(Path base) throws Exception { |
36526 | 117 |
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
118 |
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { |
|
119 |
Path moduleSrc = base.resolve("module-src"); |
|
120 |
Path m1 = moduleSrc.resolve("m1"); |
|
121 |
||
122 |
tb.writeJavaFiles(m1, "module m1 { }", |
|
123 |
"package p;", |
|
124 |
"package p; class T { }"); |
|
125 |
||
126 |
Path classes = base.resolve("classes"); |
|
127 |
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(moduleSrc)); |
|
128 |
List<String> options = Arrays.asList("-d", classes.toString(), "-Xpkginfo:always"); |
|
129 |
JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, fm, null, options, null, files); |
|
130 |
||
131 |
Iterable<? extends CompilationUnitTree> parsed = task.parse(); |
|
132 |
Iterable<? extends Element> entered = task.enter(parsed); |
|
133 |
Iterable<? extends Element> analyzed = task.analyze(entered); |
|
134 |
Iterable<? extends JavaFileObject> generatedFiles = task.generate(analyzed); |
|
135 |
||
136 |
Set<String> generated = new HashSet<>(); |
|
137 |
||
138 |
for (JavaFileObject jfo : generatedFiles) { |
|
139 |
generated.add(jfo.getName()); |
|
140 |
} |
|
141 |
||
142 |
Set<String> expected = new HashSet<>( |
|
143 |
Arrays.asList(Paths.get("testParseEnterAnalyze", "classes", "p", "package-info.class").toString(), |
|
144 |
Paths.get("testParseEnterAnalyze", "classes", "module-info.class").toString(), |
|
145 |
Paths.get("testParseEnterAnalyze", "classes", "p", "T.class").toString()) |
|
146 |
); |
|
147 |
||
148 |
if (!Objects.equals(expected, generated)) |
|
149 |
throw new AssertionError("Incorrect generated files: " + generated); |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
@Test |
|
37758 | 154 |
public void testModuleImplicitModuleBoundaries(Path base) throws Exception { |
36526 | 155 |
Path src = base.resolve("src"); |
156 |
Path src_m1 = src.resolve("m1"); |
|
157 |
tb.writeJavaFiles(src_m1, |
|
158 |
"module m1 { exports api1; }", |
|
159 |
"package api1; public class Api1 { public void call() { } }"); |
|
160 |
Path src_m2 = src.resolve("m2"); |
|
161 |
tb.writeJavaFiles(src_m2, |
|
162 |
"module m2 { requires m1; exports api2; }", |
|
163 |
"package api2; public class Api2 { public static api1.Api1 get() { return null; } }"); |
|
164 |
Path src_m3 = src.resolve("m3"); |
|
165 |
tb.writeJavaFiles(src_m3, |
|
166 |
"module m3 { requires m2; }", |
|
167 |
"package test; public class Test { { api2.Api2.get().call(); api2.Api2.get().toString(); } }"); |
|
168 |
Path classes = base.resolve("classes"); |
|
169 |
tb.createDirectories(classes); |
|
170 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
171 |
String log = new JavacTask(tb) |
36526 | 172 |
.options("-XDrawDiagnostics", |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
173 |
"--module-source-path", src.toString()) |
36526 | 174 |
.outdir(classes) |
175 |
.files(findJavaFiles(src)) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
176 |
.run(Task.Expect.FAIL) |
36526 | 177 |
.writeAll() |
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
178 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 179 |
|
180 |
if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access: call(), api1.Api1") || |
|
181 |
!log.contains("Test.java:1:76: compiler.err.not.def.access.class.intf.cant.access: toString(), java.lang.Object")) |
|
182 |
throw new Exception("expected output not found"); |
|
183 |
} |
|
184 |
||
185 |
@Test |
|
37758 | 186 |
public void testAssignClassToAutomaticModule(Path base) throws Exception { |
36526 | 187 |
//check that if a ClassSymbol belongs to an automatic module, it is properly assigned and not |
188 |
//duplicated when being accessed through a classfile. |
|
189 |
Path automaticSrc = base.resolve("automaticSrc"); |
|
190 |
tb.writeJavaFiles(automaticSrc, "package api1; public class Api1 {}"); |
|
191 |
Path automaticClasses = base.resolve("automaticClasses"); |
|
192 |
tb.createDirectories(automaticClasses); |
|
193 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
194 |
String automaticLog = new JavacTask(tb) |
36526 | 195 |
.outdir(automaticClasses) |
196 |
.files(findJavaFiles(automaticSrc)) |
|
197 |
.run() |
|
198 |
.writeAll() |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
199 |
.getOutput(Task.OutputKind.DIRECT); |
36526 | 200 |
|
201 |
if (!automaticLog.isEmpty()) |
|
202 |
throw new Exception("expected output not found: " + automaticLog); |
|
203 |
||
204 |
Path modulePath = base.resolve("module-path"); |
|
205 |
||
206 |
Files.createDirectories(modulePath); |
|
207 |
||
208 |
Path automaticJar = modulePath.resolve("m1-1.0.jar"); |
|
209 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
210 |
new JarTask(tb, automaticJar) |
36526 | 211 |
.baseDir(automaticClasses) |
212 |
.files("api1/Api1.class") |
|
213 |
.run(); |
|
214 |
||
215 |
Path src = base.resolve("src"); |
|
216 |
Path src_m2 = src.resolve("m2"); |
|
217 |
tb.writeJavaFiles(src_m2, |
|
218 |
"module m2 { requires m1; exports api2; }", |
|
219 |
"package api2; public class Api2 { public static api1.Api1 get() { return null; } }"); |
|
220 |
Path src_m3 = src.resolve("m3"); |
|
221 |
tb.writeJavaFiles(src_m3, |
|
222 |
"module m3 { requires m1; requires m2; }", |
|
223 |
"package test; public class Test { { api2.Api2.get(); api1.Api1 a1; } }"); |
|
224 |
Path classes = base.resolve("classes"); |
|
225 |
tb.createDirectories(classes); |
|
226 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
227 |
new JavacTask(tb) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
228 |
.options("--module-path", modulePath.toString(), |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
229 |
"--module-source-path", src.toString()) |
36526 | 230 |
.outdir(classes) |
231 |
.files(findJavaFiles(src_m2)) |
|
232 |
.run() |
|
233 |
.writeAll(); |
|
234 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
235 |
new JavacTask(tb) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
236 |
.options("--module-path", modulePath.toString(), |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
237 |
"--module-source-path", src.toString()) |
36526 | 238 |
.outdir(classes) |
239 |
.files(findJavaFiles(src_m3)) |
|
240 |
.run() |
|
241 |
.writeAll(); |
|
242 |
} |
|
243 |
||
244 |
@Test |
|
37758 | 245 |
public void testEmptyImplicitModuleInfo(Path base) throws Exception { |
36526 | 246 |
Path src = base.resolve("src"); |
247 |
Path src_m1 = src.resolve("m1"); |
|
248 |
Files.createDirectories(src_m1); |
|
249 |
try (Writer w = Files.newBufferedWriter(src_m1.resolve("module-info.java"))) {} |
|
250 |
tb.writeJavaFiles(src_m1, |
|
251 |
"package test; public class Test {}"); |
|
252 |
Path classes = base.resolve("classes"); |
|
253 |
tb.createDirectories(classes); |
|
254 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
255 |
new JavacTask(tb) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
256 |
.options("--source-path", src_m1.toString(), |
36526 | 257 |
"-XDrawDiagnostics") |
258 |
.outdir(classes) |
|
259 |
.files(findJavaFiles(src_m1.resolve("test"))) |
|
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
260 |
.run(Task.Expect.FAIL) |
36526 | 261 |
.writeAll(); |
262 |
||
263 |
tb.writeJavaFiles(src_m1, |
|
264 |
"module m1 {}"); |
|
265 |
||
36778
e04318f39f92
8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents:
36526
diff
changeset
|
266 |
new JavacTask(tb) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
267 |
.options("--source-path", src_m1.toString()) |
36526 | 268 |
.outdir(classes) |
269 |
.files(findJavaFiles(src_m1.resolve("test"))) |
|
270 |
.run() |
|
271 |
.writeAll(); |
|
272 |
||
273 |
} |
|
274 |
||
37744
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
275 |
@Test |
37758 | 276 |
public void testClassPackageClash(Path base) throws Exception { |
37744
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
277 |
Path src = base.resolve("src"); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
278 |
Path src_m1 = src.resolve("m1"); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
279 |
tb.writeJavaFiles(src_m1, |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
280 |
"module m1 { exports test.m1; }", |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
281 |
"package test.m1;\n" + |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
282 |
"public class Test {}\n"); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
283 |
Path src_m2 = src.resolve("m2"); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
284 |
tb.writeJavaFiles(src_m2, |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
285 |
"module m2 { requires m1; }", |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
286 |
"package test;\n" + |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
287 |
"public class m1 {}\n"); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
288 |
Path classes = base.resolve("classes"); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
289 |
tb.createDirectories(classes); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
290 |
|
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
291 |
List<String> log = new JavacTask(tb) |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37758
diff
changeset
|
292 |
.options("--module-source-path", src.toString(), |
37744
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
293 |
"-XDrawDiagnostics") |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
294 |
.outdir(classes) |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
295 |
.files(findJavaFiles(src)) |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
296 |
.run(Task.Expect.FAIL) |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
297 |
.writeAll() |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
298 |
.getOutputLines(Task.OutputKind.DIRECT); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
299 |
|
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
300 |
List<String> expected = Arrays.asList( |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
301 |
"m1.java:2:8: compiler.err.clash.with.pkg.of.same.name: kindname.class, test.m1", |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
302 |
"1 error" |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
303 |
); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
304 |
|
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
305 |
if (!expected.equals(log)) { |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
306 |
throw new IllegalStateException(log.toString()); |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
307 |
} |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
308 |
} |
bf4fd5e022c5
8154283: Check for clash between package and class not working when package in a different module
jlahoda
parents:
36778
diff
changeset
|
309 |
|
41254
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
310 |
@Test |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
311 |
public void testImplicitJavaBase(Path base) throws Exception { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
312 |
Path src = base.resolve("src"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
313 |
Path src_java_base = src.resolve("java.base"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
314 |
Files.createDirectories(src_java_base); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
315 |
tb.writeJavaFiles(src_java_base, "module java.base { exports java.lang; }"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
316 |
tb.writeJavaFiles(src_java_base, |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
317 |
"package java.lang; public class Object {}"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
318 |
Path classes = base.resolve("classes"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
319 |
tb.createDirectories(classes); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
320 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
321 |
//module-info from source: |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
322 |
new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
323 |
.options("-sourcepath", src_java_base.toString()) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
324 |
.outdir(classes) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
325 |
.files(findJavaFiles(src_java_base.resolve("java").resolve("lang").resolve("Object.java"))) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
326 |
.run() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
327 |
.writeAll(); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
328 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
329 |
//module-info from class: |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
330 |
if (!Files.exists(classes.resolve("module-info.class"))) { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
331 |
throw new AssertionError("module-info.class not created!"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
332 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
333 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
334 |
new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
335 |
.outdir(classes) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
336 |
.files(findJavaFiles(src_java_base.resolve("java").resolve("lang").resolve("Object.java"))) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
337 |
.run() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
338 |
.writeAll(); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
339 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
340 |
//broken module-info.class: |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
341 |
Files.newOutputStream(classes.resolve("module-info.class")).close(); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
342 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
343 |
List<String> log = new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
344 |
.options("-XDrawDiagnostics") |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
345 |
.outdir(classes) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
346 |
.files(findJavaFiles(src_java_base.resolve("java").resolve("lang").resolve("Object.java"))) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
347 |
.run(Expect.FAIL) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
348 |
.writeAll() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
349 |
.getOutputLines(OutputKind.DIRECT); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
350 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
351 |
List<String> expected = Arrays.asList( |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
352 |
"- compiler.err.cant.access: <error>.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.illegal.start.of.class.file))", |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
353 |
"1 error"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
354 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
355 |
if (!expected.equals(log)) { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
356 |
throw new AssertionError("Unexpected output: " + log); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
357 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
358 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
359 |
//broken module-info.java: |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
360 |
Files.delete(classes.resolve("module-info.class")); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
361 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
362 |
try (Writer out = Files.newBufferedWriter(src_java_base.resolve("module-info.java"))) { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
363 |
out.write("class Broken {}"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
364 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
365 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
366 |
log = new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
367 |
.options("-sourcepath", src_java_base.toString(), |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
368 |
"-XDrawDiagnostics") |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
369 |
.outdir(classes) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
370 |
.files(findJavaFiles(src_java_base.resolve("java").resolve("lang").resolve("Object.java"))) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
371 |
.run(Expect.FAIL) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
372 |
.writeAll() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
373 |
.getOutputLines(OutputKind.DIRECT); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
374 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
375 |
expected = Arrays.asList("X"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
376 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
377 |
if (expected.equals(log)) { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
378 |
throw new AssertionError("Unexpected output: " + log); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
379 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
380 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
381 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
382 |
@Test |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
383 |
public void testModuleInfoNameMismatchSource(Path base) throws Exception { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
384 |
Path src = base.resolve("src"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
385 |
Path m1 = src.resolve("m1"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
386 |
Files.createDirectories(m1); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
387 |
tb.writeJavaFiles(m1, "module other { }", |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
388 |
"package test; public class Test {}"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
389 |
Path classes = base.resolve("classes"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
390 |
tb.createDirectories(classes); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
391 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
392 |
List<String> log = new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
393 |
.options("--module-source-path", src.toString(), |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
394 |
"-XDrawDiagnostics") |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
395 |
.outdir(classes) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
396 |
.files(findJavaFiles(m1.resolve("test").resolve("Test.java"))) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
397 |
.run(Expect.FAIL) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
398 |
.writeAll() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
399 |
.getOutputLines(OutputKind.DIRECT); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
400 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
401 |
List<String> expected = Arrays.asList( |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
402 |
"module-info.java:1:1: compiler.err.module.name.mismatch: other, m1", |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
403 |
"- compiler.err.cant.access: m1.module-info, (compiler.misc.cant.resolve.modules)", |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
404 |
"2 errors"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
405 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
406 |
if (!expected.equals(log)) { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
407 |
throw new AssertionError("Unexpected output: " + log); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
408 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
409 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
410 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
411 |
@Test |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
412 |
public void testModuleInfoNameMismatchClass(Path base) throws Exception { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
413 |
Path src = base.resolve("src"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
414 |
Files.createDirectories(src); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
415 |
tb.writeJavaFiles(src, "module other { }", |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
416 |
"package test; public class Test {}"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
417 |
Path classes = base.resolve("classes"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
418 |
Path m1Classes = classes.resolve("m1"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
419 |
tb.createDirectories(m1Classes); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
420 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
421 |
new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
422 |
.outdir(m1Classes) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
423 |
.files(findJavaFiles(src)) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
424 |
.run() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
425 |
.writeAll() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
426 |
.getOutputLines(OutputKind.DIRECT); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
427 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
428 |
Path src2 = base.resolve("src2"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
429 |
Files.createDirectories(src2); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
430 |
tb.writeJavaFiles(src2, "module use { requires m1; }"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
431 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
432 |
Path classes2 = base.resolve("classes2"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
433 |
tb.createDirectories(classes2); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
434 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
435 |
List<String> log = new JavacTask(tb) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
436 |
.options("--module-path", classes.toString(), |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
437 |
"-XDrawDiagnostics") |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
438 |
.outdir(classes2) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
439 |
.files(findJavaFiles(src2)) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
440 |
.run(Expect.FAIL) |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
441 |
.writeAll() |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
442 |
.getOutputLines(OutputKind.DIRECT); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
443 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
444 |
List<String> expected = Arrays.asList( |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
445 |
"- compiler.err.cant.access: m1.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.module.name.mismatch: other, m1))", |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
446 |
"1 error"); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
447 |
|
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
448 |
if (!expected.equals(log)) { |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
449 |
throw new AssertionError("Unexpected output: " + log); |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
450 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
451 |
} |
08f8dbf7741e
8152911: javac assertion error when compiling overlay sources
jlahoda
parents:
40308
diff
changeset
|
452 |
|
41516
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
453 |
@Test |
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
454 |
public void testGetDirectivesComplete(Path base) throws Exception { |
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
455 |
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
456 |
JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, null, null, null); |
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
457 |
Symtab syms = Symtab.instance(task.getContext()); |
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
458 |
|
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
459 |
syms.java_base.getDirectives(); |
0a5838f027a4
8167320: Trying to document only java.base causes a NPE in javac
jlahoda
parents:
41254
diff
changeset
|
460 |
} |
36526 | 461 |
} |