8169069: Module system implementation refresh (11/2016)

Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Bhavesh Patel <bhavesh.x.patel@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Reviewed-by: mcimadamore, jjg, mchung, anazarov
This commit is contained in:
Alan Bateman 2016-12-01 09:02:42 +00:00
parent 51f50b64e5
commit 22e233b2e9
214 changed files with 5453 additions and 1175 deletions

View file

@ -22,7 +22,7 @@
*/
/**
* @test 8144342 8149658
* @test 8144342 8149658 8162713
* @summary javac doesn't report errors if module exports non-existent package
* @library /tools/lib
* @modules
@ -103,4 +103,45 @@ public class ReportNonExistentPackageTest extends ModuleTestBase {
if (!log.contains("module-info.java:1:20: compiler.err.package.empty.or.not.found: p1"))
throw new Exception("expected output not found");
}
@Test
public void testExportPrivateEmptyPackage(Path base) throws Exception {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"module m { opens p; }");
Path classes = base.resolve("classes");
Files.createDirectories(classes);
String log = new JavacTask(tb)
.options("-XDrawDiagnostics")
.outdir(classes)
.files(findJavaFiles(src))
.run(Task.Expect.FAIL)
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
if (!log.contains("module-info.java:1:18: compiler.err.package.empty.or.not.found: p"))
throw new Exception("expected output not found, actual output: " + log);
}
@Test
public void testExportPrivateOnlyWithResources(Path base) throws Exception {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"module m { opens p; }");
Path resource = src.resolve("p").resolve("resource.properties");
Files.createDirectories(resource.getParent());
Files.newOutputStream(resource).close();
Path classes = base.resolve("classes");
Files.createDirectories(classes);
String log = new JavacTask(tb)
.sourcepath(src.toString())
.outdir(classes)
.files(findJavaFiles(src))
.run()
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
if (!log.equals(""))
throw new Exception("expected output not found, actual output: " + log);
}
}