8189765: Improve error reporting for compiling against package not visible due to modules

When looking in other modules for an undefined Symbol, also look into the unnamed module.

Reviewed-by: mcimadamore
This commit is contained in:
Jan Lahoda 2018-04-12 09:23:34 +02:00
parent 8483faa4a9
commit 594fb594ce
4 changed files with 9 additions and 8 deletions

View file

@ -23,7 +23,7 @@
/*
* @test
* @bug 8169197 8172668 8173117 8175007
* @bug 8169197 8172668 8173117 8175007 8189765
* @summary Check convenient errors are produced for inaccessible classes.
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
@ -199,7 +199,7 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
throw new Exception("expected output not found; actual: " + log);
}
// @Test
@Test
public void testInaccessibleUnnamedModule(Path base) throws Exception {
Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }");
@ -224,8 +224,8 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
.getOutputLines(Task.OutputKind.DIRECT);
List<String> expected = Arrays.asList(
"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)",
"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)",
"Test.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
"Test.java:1:48: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
"2 errors");
if (!expected.equals(log))