8166538: Improve error reporting for compiling against unexported package

When a type cannot be found, look into other modules, search for possible viable types, and report them conveniently to the user.

Reviewed-by: mcimadamore, jjg
This commit is contained in:
Jan Lahoda 2016-11-02 16:48:57 +01:00
parent 0032be0658
commit 5daafbe43b
71 changed files with 1926 additions and 114 deletions

View file

@ -100,7 +100,7 @@ public class ResolveTest extends ModuleTestBase {
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2, p1, m1)"))
throw new Exception("expected output not found");
}
@ -124,7 +124,7 @@ public class ResolveTest extends ModuleTestBase {
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported: p1, m1)"))
throw new Exception("expected output not found");
}
@ -150,7 +150,7 @@ public class ResolveTest extends ModuleTestBase {
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported.to.module: p1, m1, m2)"))
throw new Exception("expected output not found");
}
@ -174,7 +174,7 @@ public class ResolveTest extends ModuleTestBase {
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2, p1, m1)"))
throw new Exception("expected output not found");
}