mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
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:
parent
51f50b64e5
commit
22e233b2e9
214 changed files with 5453 additions and 1175 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue