equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8169197 8172668 8173117 8175007 |
26 * @bug 8169197 8172668 8173117 8175007 8189765 |
27 * @summary Check convenient errors are produced for inaccessible classes. |
27 * @summary Check convenient errors are produced for inaccessible classes. |
28 * @library /tools/lib |
28 * @library /tools/lib |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.main |
30 * jdk.compiler/com.sun.tools.javac.main |
31 * jdk.compiler/com.sun.tools.javac.util |
31 * jdk.compiler/com.sun.tools.javac.util |
197 |
197 |
198 if (!expected.equals(log)) |
198 if (!expected.equals(log)) |
199 throw new Exception("expected output not found; actual: " + log); |
199 throw new Exception("expected output not found; actual: " + log); |
200 } |
200 } |
201 |
201 |
202 // @Test |
202 @Test |
203 public void testInaccessibleUnnamedModule(Path base) throws Exception { |
203 public void testInaccessibleUnnamedModule(Path base) throws Exception { |
204 Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }"); |
204 Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }"); |
205 |
205 |
206 Path moduleSrc = base.resolve("module-src"); |
206 Path moduleSrc = base.resolve("module-src"); |
207 Path m1x = moduleSrc.resolve("m1x"); |
207 Path m1x = moduleSrc.resolve("m1x"); |
222 .run(Task.Expect.FAIL) |
222 .run(Task.Expect.FAIL) |
223 .writeAll() |
223 .writeAll() |
224 .getOutputLines(Task.OutputKind.DIRECT); |
224 .getOutputLines(Task.OutputKind.DIRECT); |
225 |
225 |
226 List<String> expected = Arrays.asList( |
226 List<String> expected = Arrays.asList( |
227 "Test.java:1:38: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)", |
227 "Test.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)", |
228 "Test.java:1:51: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)", |
228 "Test.java:1:48: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)", |
229 "2 errors"); |
229 "2 errors"); |
230 |
230 |
231 if (!expected.equals(log)) |
231 if (!expected.equals(log)) |
232 throw new Exception("expected output not found; actual: " + log); |
232 throw new Exception("expected output not found; actual: " + log); |
233 } |
233 } |