8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
2016-06-28 11:33:04 +00:00
|
|
|
* @bug 8155026
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
* @summary Test automatic modules
|
|
|
|
* @library /tools/lib
|
|
|
|
* @modules
|
2016-06-28 11:33:04 +00:00
|
|
|
* java.desktop
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
* jdk.compiler/com.sun.tools.javac.api
|
|
|
|
* jdk.compiler/com.sun.tools.javac.main
|
2016-03-31 22:20:50 +00:00
|
|
|
* @build toolbox.ToolBox toolbox.JavacTask toolbox.JarTask ModuleTestBase
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
* @run main AutomaticModules
|
|
|
|
*/
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.nio.file.Path;
|
2016-06-28 11:33:04 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
import toolbox.JarTask;
|
|
|
|
import toolbox.JavacTask;
|
|
|
|
import toolbox.Task;
|
|
|
|
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
public class AutomaticModules extends ModuleTestBase {
|
|
|
|
|
|
|
|
public static void main(String... args) throws Exception {
|
|
|
|
AutomaticModules t = new AutomaticModules();
|
|
|
|
t.runTests();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2016-05-02 23:17:39 +00:00
|
|
|
public void testSimple(Path base) throws Exception {
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
Path legacySrc = base.resolve("legacy-src");
|
|
|
|
tb.writeJavaFiles(legacySrc,
|
|
|
|
"package api; import java.awt.event.ActionListener; public abstract class Api implements ActionListener {}");
|
|
|
|
Path legacyClasses = base.resolve("legacy-classes");
|
|
|
|
Files.createDirectories(legacyClasses);
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
String log = new JavacTask(tb)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.options()
|
|
|
|
.outdir(legacyClasses)
|
|
|
|
.files(findJavaFiles(legacySrc))
|
|
|
|
.run()
|
|
|
|
.writeAll()
|
2016-03-31 22:20:50 +00:00
|
|
|
.getOutput(Task.OutputKind.DIRECT);
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
|
|
|
if (!log.isEmpty()) {
|
|
|
|
throw new Exception("unexpected output: " + log);
|
|
|
|
}
|
|
|
|
|
|
|
|
Path modulePath = base.resolve("module-path");
|
|
|
|
|
|
|
|
Files.createDirectories(modulePath);
|
|
|
|
|
|
|
|
Path jar = modulePath.resolve("test-api-1.0.jar");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JarTask(tb, jar)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.baseDir(legacyClasses)
|
|
|
|
.files("api/Api.class")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Path moduleSrc = base.resolve("module-src");
|
2016-12-16 05:47:58 +00:00
|
|
|
Path m1 = moduleSrc.resolve("m1x");
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
|
|
|
Path classes = base.resolve("classes");
|
|
|
|
|
|
|
|
Files.createDirectories(classes);
|
|
|
|
|
|
|
|
tb.writeJavaFiles(m1,
|
2016-12-16 05:47:58 +00:00
|
|
|
"module m1x { requires test.api; requires java.desktop; }",
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
"package impl; public class Impl { public void e(api.Api api) { api.actionPerformed(null); } }");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JavacTask(tb)
|
2016-08-10 22:47:46 +00:00
|
|
|
.options("--module-source-path", moduleSrc.toString(), "--module-path", modulePath.toString())
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(moduleSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2016-05-02 23:17:39 +00:00
|
|
|
public void testUnnamedModule(Path base) throws Exception {
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
Path legacySrc = base.resolve("legacy-src");
|
|
|
|
tb.writeJavaFiles(legacySrc,
|
|
|
|
"package api; public abstract class Api { public void run(CharSequence str) { } private void run(base.Base base) { } }",
|
|
|
|
"package base; public interface Base { public void run(); }");
|
|
|
|
Path legacyClasses = base.resolve("legacy-classes");
|
|
|
|
Files.createDirectories(legacyClasses);
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
String log = new JavacTask(tb)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.options()
|
|
|
|
.outdir(legacyClasses)
|
|
|
|
.files(findJavaFiles(legacySrc))
|
|
|
|
.run()
|
|
|
|
.writeAll()
|
2016-03-31 22:20:50 +00:00
|
|
|
.getOutput(Task.OutputKind.DIRECT);
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
|
|
|
if (!log.isEmpty()) {
|
|
|
|
throw new Exception("unexpected output: " + log);
|
|
|
|
}
|
|
|
|
|
|
|
|
Path modulePath = base.resolve("module-path");
|
|
|
|
|
|
|
|
Files.createDirectories(modulePath);
|
|
|
|
|
|
|
|
Path apiJar = modulePath.resolve("test-api-1.0.jar");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JarTask(tb, apiJar)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.baseDir(legacyClasses)
|
|
|
|
.files("api/Api.class")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Path baseJar = base.resolve("base.jar");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JarTask(tb, baseJar)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.baseDir(legacyClasses)
|
|
|
|
.files("base/Base.class")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Path moduleSrc = base.resolve("module-src");
|
2016-12-16 05:47:58 +00:00
|
|
|
Path m1 = moduleSrc.resolve("m1x");
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
|
|
|
Path classes = base.resolve("classes");
|
|
|
|
|
|
|
|
Files.createDirectories(classes);
|
|
|
|
|
|
|
|
tb.writeJavaFiles(m1,
|
2016-12-16 05:47:58 +00:00
|
|
|
"module m1x { requires test.api; }",
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
"package impl; public class Impl { public void e(api.Api api) { api.run(\"\"); } }");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JavacTask(tb)
|
2016-08-10 22:47:46 +00:00
|
|
|
.options("--module-source-path", moduleSrc.toString(), "--module-path", modulePath.toString(), "--class-path", baseJar.toString())
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(moduleSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2016-05-02 23:17:39 +00:00
|
|
|
public void testModuleInfoFromClassFileDependsOnAutomatic(Path base) throws Exception {
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
Path automaticSrc = base.resolve("automaticSrc");
|
|
|
|
tb.writeJavaFiles(automaticSrc, "package api; public class Api {}");
|
|
|
|
Path automaticClasses = base.resolve("automaticClasses");
|
|
|
|
tb.createDirectories(automaticClasses);
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
String automaticLog = new JavacTask(tb)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.outdir(automaticClasses)
|
|
|
|
.files(findJavaFiles(automaticSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll()
|
2016-03-31 22:20:50 +00:00
|
|
|
.getOutput(Task.OutputKind.DIRECT);
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
|
|
|
if (!automaticLog.isEmpty())
|
|
|
|
throw new Exception("expected output not found: " + automaticLog);
|
|
|
|
|
|
|
|
Path modulePath = base.resolve("module-path");
|
|
|
|
|
|
|
|
Files.createDirectories(modulePath);
|
|
|
|
|
|
|
|
Path automaticJar = modulePath.resolve("automatic-1.0.jar");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JarTask(tb, automaticJar)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.baseDir(automaticClasses)
|
|
|
|
.files("api/Api.class")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Path depSrc = base.resolve("depSrc");
|
|
|
|
Path depClasses = base.resolve("depClasses");
|
|
|
|
|
|
|
|
Files.createDirectories(depSrc);
|
|
|
|
Files.createDirectories(depClasses);
|
|
|
|
|
|
|
|
tb.writeJavaFiles(depSrc,
|
2016-12-16 05:47:58 +00:00
|
|
|
"module m1x { requires transitive automatic; }",
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
"package dep; public class Dep { api.Api api; }");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JavacTask(tb)
|
2016-08-10 22:47:46 +00:00
|
|
|
.options("--module-path", modulePath.toString())
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.outdir(depClasses)
|
|
|
|
.files(findJavaFiles(depSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll();
|
|
|
|
|
2016-12-16 05:47:58 +00:00
|
|
|
Path moduleJar = modulePath.resolve("m1x.jar");
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JarTask(tb, moduleJar)
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.baseDir(depClasses)
|
|
|
|
.files("module-info.class", "dep/Dep.class")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Path testSrc = base.resolve("testSrc");
|
|
|
|
Path testClasses = base.resolve("testClasses");
|
|
|
|
|
|
|
|
Files.createDirectories(testSrc);
|
|
|
|
Files.createDirectories(testClasses);
|
|
|
|
|
|
|
|
tb.writeJavaFiles(testSrc,
|
2016-12-16 05:47:58 +00:00
|
|
|
"module m2x { requires automatic; }",
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
"package test; public class Test { }");
|
|
|
|
|
2016-03-31 22:20:50 +00:00
|
|
|
new JavacTask(tb)
|
2016-08-10 22:47:46 +00:00
|
|
|
.options("--module-path", modulePath.toString())
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
.outdir(testClasses)
|
|
|
|
.files(findJavaFiles(testSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll();
|
|
|
|
}
|
2016-06-28 11:33:04 +00:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testAutomaticAndNamedModules(Path base) throws Exception {
|
|
|
|
Path modulePath = base.resolve("module-path");
|
|
|
|
|
|
|
|
Files.createDirectories(modulePath);
|
|
|
|
|
|
|
|
for (char c : new char[] {'A', 'B'}) {
|
|
|
|
Path automaticSrc = base.resolve("automaticSrc" + c);
|
|
|
|
tb.writeJavaFiles(automaticSrc, "package api" + c + "; public class Api {}");
|
|
|
|
Path automaticClasses = base.resolve("automaticClasses" + c);
|
|
|
|
tb.createDirectories(automaticClasses);
|
|
|
|
|
|
|
|
String automaticLog = new JavacTask(tb)
|
|
|
|
.outdir(automaticClasses)
|
|
|
|
.files(findJavaFiles(automaticSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll()
|
|
|
|
.getOutput(Task.OutputKind.DIRECT);
|
|
|
|
|
|
|
|
if (!automaticLog.isEmpty())
|
|
|
|
throw new Exception("expected output not found: " + automaticLog);
|
|
|
|
|
|
|
|
Path automaticJar = modulePath.resolve("automatic" + c + "-1.0.jar");
|
|
|
|
|
|
|
|
new JarTask(tb, automaticJar)
|
|
|
|
.baseDir(automaticClasses)
|
|
|
|
.files("api" + c + "/Api.class")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
Path moduleSrc = base.resolve("module-src");
|
|
|
|
|
2016-12-16 05:47:58 +00:00
|
|
|
tb.writeJavaFiles(moduleSrc.resolve("m1x"),
|
|
|
|
"module m1x { requires static automaticA; }",
|
|
|
|
"package impl; public class Impl { apiA.Api a; apiB.Api b; m2x.M2 m;}");
|
2016-06-28 11:33:04 +00:00
|
|
|
|
2016-12-16 05:47:58 +00:00
|
|
|
tb.writeJavaFiles(moduleSrc.resolve("m2x"),
|
|
|
|
"module m2x { exports m2x; }",
|
|
|
|
"package m2x; public class M2 { }");
|
2016-06-28 11:33:04 +00:00
|
|
|
|
|
|
|
Path classes = base.resolve("classes");
|
|
|
|
|
|
|
|
Files.createDirectories(classes);
|
|
|
|
|
|
|
|
List<String> log = new JavacTask(tb)
|
2016-08-10 22:47:46 +00:00
|
|
|
.options("--module-source-path", moduleSrc.toString(),
|
|
|
|
"--module-path", modulePath.toString(),
|
|
|
|
"--add-modules", "automaticB",
|
2016-06-28 11:33:04 +00:00
|
|
|
"-XDrawDiagnostics")
|
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(moduleSrc))
|
|
|
|
.run(Task.Expect.FAIL)
|
|
|
|
.writeAll()
|
|
|
|
.getOutputLines(Task.OutputKind.DIRECT);
|
|
|
|
|
2017-01-11 09:59:57 +00:00
|
|
|
List<String> expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
|
2016-06-28 11:33:04 +00:00
|
|
|
"1 error");
|
|
|
|
|
|
|
|
if (!expected.equals(log)) {
|
|
|
|
throw new Exception("expected output not found: " + log);
|
|
|
|
}
|
|
|
|
|
|
|
|
log = new JavacTask(tb)
|
2016-08-10 22:47:46 +00:00
|
|
|
.options("--module-source-path", moduleSrc.toString(),
|
|
|
|
"--module-path", modulePath.toString(),
|
2016-06-28 11:33:04 +00:00
|
|
|
"-XDrawDiagnostics")
|
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(moduleSrc))
|
|
|
|
.run(Task.Expect.FAIL)
|
|
|
|
.writeAll()
|
|
|
|
.getOutputLines(Task.OutputKind.DIRECT);
|
|
|
|
|
2017-04-07 08:08:26 +00:00
|
|
|
expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
|
|
|
|
"1 error");
|
2016-06-28 11:33:04 +00:00
|
|
|
|
|
|
|
if (!expected.equals(log)) {
|
|
|
|
throw new Exception("expected output not found: " + log);
|
|
|
|
}
|
|
|
|
}
|
2016-12-01 09:02:42 +00:00
|
|
|
|
|
|
|
@Test
|
2017-04-07 08:08:26 +00:00
|
|
|
public void testWithTrailingVersion(Path base) throws Exception {
|
2016-12-01 09:02:42 +00:00
|
|
|
Path legacySrc = base.resolve("legacy-src");
|
|
|
|
tb.writeJavaFiles(legacySrc,
|
|
|
|
"package api; public class Api {}");
|
|
|
|
Path legacyClasses = base.resolve("legacy-classes");
|
|
|
|
Files.createDirectories(legacyClasses);
|
|
|
|
|
|
|
|
String log = new JavacTask(tb)
|
|
|
|
.options()
|
|
|
|
.outdir(legacyClasses)
|
|
|
|
.files(findJavaFiles(legacySrc))
|
|
|
|
.run()
|
|
|
|
.writeAll()
|
|
|
|
.getOutput(Task.OutputKind.DIRECT);
|
|
|
|
|
|
|
|
if (!log.isEmpty()) {
|
|
|
|
throw new Exception("unexpected output: " + log);
|
|
|
|
}
|
|
|
|
|
|
|
|
Path modulePath = base.resolve("module-path");
|
|
|
|
|
|
|
|
Files.createDirectories(modulePath);
|
|
|
|
|
|
|
|
Path jar = modulePath.resolve("test1.jar");
|
|
|
|
|
|
|
|
new JarTask(tb, jar)
|
|
|
|
.baseDir(legacyClasses)
|
|
|
|
.files("api/Api.class")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Path moduleSrc = base.resolve("module-src");
|
|
|
|
Path m = moduleSrc.resolve("m");
|
|
|
|
|
|
|
|
Path classes = base.resolve("classes");
|
|
|
|
|
|
|
|
Files.createDirectories(classes);
|
|
|
|
|
|
|
|
tb.writeJavaFiles(m,
|
2017-04-07 08:08:26 +00:00
|
|
|
"module m { requires test1; }",
|
2016-12-01 09:02:42 +00:00
|
|
|
"package impl; public class Impl { public void e(api.Api api) { } }");
|
|
|
|
|
|
|
|
new JavacTask(tb)
|
|
|
|
.options("--module-source-path", moduleSrc.toString(), "--module-path", modulePath.toString())
|
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(moduleSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll();
|
|
|
|
}
|
2017-04-07 08:08:26 +00:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testMultipleAutomatic(Path base) throws Exception {
|
|
|
|
Path modulePath = base.resolve("module-path");
|
|
|
|
|
|
|
|
Files.createDirectories(modulePath);
|
|
|
|
|
|
|
|
for (char c : new char[] {'A', 'B'}) {
|
|
|
|
Path automaticSrc = base.resolve("automaticSrc" + c);
|
|
|
|
tb.writeJavaFiles(automaticSrc, "package api" + c + "; public class Api {}");
|
|
|
|
Path automaticClasses = base.resolve("automaticClasses" + c);
|
|
|
|
tb.createDirectories(automaticClasses);
|
|
|
|
|
|
|
|
String automaticLog = new JavacTask(tb)
|
|
|
|
.outdir(automaticClasses)
|
|
|
|
.files(findJavaFiles(automaticSrc))
|
|
|
|
.run()
|
|
|
|
.writeAll()
|
|
|
|
.getOutput(Task.OutputKind.DIRECT);
|
|
|
|
|
|
|
|
if (!automaticLog.isEmpty())
|
|
|
|
throw new Exception("expected output not found: " + automaticLog);
|
|
|
|
|
|
|
|
Path automaticJar = modulePath.resolve("automatic" + c + "-1.0.jar");
|
|
|
|
|
|
|
|
new JarTask(tb, automaticJar)
|
|
|
|
.baseDir(automaticClasses)
|
|
|
|
.files("api" + c + "/Api.class")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
Path src = base.resolve("src");
|
|
|
|
|
|
|
|
tb.writeJavaFiles(src.resolve("m1x"),
|
|
|
|
"package impl; public class Impl { apiA.Api a; apiB.Api b; }");
|
|
|
|
|
|
|
|
Path classes = base.resolve("classes");
|
|
|
|
|
|
|
|
Files.createDirectories(classes);
|
|
|
|
|
|
|
|
List<String> log = new JavacTask(tb)
|
|
|
|
.options("--module-path", modulePath.toString(),
|
|
|
|
"-XDrawDiagnostics")
|
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(src))
|
|
|
|
.run(Task.Expect.FAIL)
|
|
|
|
.writeAll()
|
|
|
|
.getOutputLines(Task.OutputKind.DIRECT);
|
|
|
|
|
|
|
|
List<String> expected = Arrays.asList("Impl.java:1:35: compiler.err.package.not.visible: apiA, (compiler.misc.not.def.access.does.not.read.from.unnamed: apiA, automaticA)",
|
|
|
|
"Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read.from.unnamed: apiB, automaticB)",
|
|
|
|
"2 errors");
|
|
|
|
|
|
|
|
if (!expected.equals(log)) {
|
|
|
|
throw new Exception("expected output not found: " + log);
|
|
|
|
}
|
|
|
|
|
|
|
|
new JavacTask(tb)
|
|
|
|
.options("--module-path", modulePath.toString(),
|
|
|
|
"--add-modules", "automaticA",
|
|
|
|
"-XDrawDiagnostics")
|
|
|
|
.outdir(classes)
|
|
|
|
.files(findJavaFiles(src))
|
|
|
|
.run()
|
|
|
|
.writeAll();
|
|
|
|
}
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Co-authored-by: Vicente Romero <vicente.romero@oracle.com>
Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com>
Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
2016-03-17 19:04:28 +00:00
|
|
|
}
|