langtools/test/tools/javac/modules/RequiresPublicTest.java
author jjg
Wed, 10 Aug 2016 15:47:46 -0700
changeset 40308 274367a99f98
parent 37758 3ecf9b414e05
child 41931 d7c9720c4223
permissions -rw-r--r--
8136930: Simplify use of module-system options by custom launchers 8160489: Multiple -Xpatch lines ignored by javac 8156998: javac should support new option -XinheritRuntimeEnvironment Reviewed-by: jlahoda, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * accompanied this code).
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * questions.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    23
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    24
/*
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    25
 * @test
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    26
 * @summary tests for "requires public"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    27
 * @library /tools/lib
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    28
 * @modules
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    29
 *      jdk.compiler/com.sun.tools.javac.api
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    30
 *      jdk.compiler/com.sun.tools.javac.main
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    31
 * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    32
 * @run main RequiresPublicTest
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    33
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    34
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    35
import java.nio.file.Files;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    36
import java.nio.file.Path;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    37
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    38
import toolbox.JavacTask;
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    39
import toolbox.Task;
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    40
import toolbox.ToolBox;
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    41
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    42
public class RequiresPublicTest extends ModuleTestBase {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    43
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    44
    public static void main(String... args) throws Exception {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    45
        RequiresPublicTest t = new RequiresPublicTest();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    46
        t.runTests();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    47
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    48
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    49
    @Test
37758
3ecf9b414e05 8155774: move code from ModuleTestBase to toolbox
jjg
parents: 36778
diff changeset
    50
    public void testJavaSE_OK(Path base) throws Exception {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    51
        Path src = base.resolve("src");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    52
        tb.writeJavaFiles(src,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    53
                "module m { requires java.se; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    54
                "import java.awt.Frame;\n"  // in java.se
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    55
                + "class Test {\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
                + "    Frame f;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
                + "}");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    58
        Path classes = base.resolve("classes");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    59
        Files.createDirectories(classes);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    60
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    61
        new JavacTask(tb, Task.Mode.CMDLINE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    62
                .files(findJavaFiles(src))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    63
                .outdir(classes)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    64
                .run()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    65
                .writeAll();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    66
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    67
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    68
    @Test
37758
3ecf9b414e05 8155774: move code from ModuleTestBase to toolbox
jjg
parents: 36778
diff changeset
    69
    public void testJavaSE_Fail(Path base) throws Exception {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    70
        Path src = base.resolve("src");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    71
        tb.writeJavaFiles(src,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    72
                "module m { requires java.se; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    73
                "import com.sun.source.tree.Tree;\n" // not in java.se (in jdk.compiler)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    74
                + "class Test {\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    75
                + "    Tree t;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    76
                + "}");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
        Path classes = base.resolve("classes");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
        Files.createDirectories(classes);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    79
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    80
        String log = new JavacTask(tb, Task.Mode.CMDLINE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    81
                .options("-XDrawDiagnostics")
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    82
                .files(findJavaFiles(src))
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37758
diff changeset
    83
                .outdir(classes)
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    84
                .run(Task.Expect.FAIL)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    85
                .writeAll()
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    86
                .getOutput(Task.OutputKind.DIRECT);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    87
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    88
        if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    89
            throw new Exception("expected output not found");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    90
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    91
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    92
    @Test
37758
3ecf9b414e05 8155774: move code from ModuleTestBase to toolbox
jjg
parents: 36778
diff changeset
    93
    public void testComplex_OK(Path base) throws Exception {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    94
        Path src = getComplexSrc(base, "", "");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    95
        Path classes = base.resolve("classes");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    96
        Files.createDirectories(classes);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    97
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
    98
        new JavacTask(tb, Task.Mode.CMDLINE)
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37758
diff changeset
    99
                .options("--module-source-path", src.toString())
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   100
                .files(findJavaFiles(src))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   101
                .outdir(classes)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   102
                .run()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   103
                .writeAll();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   104
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   105
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   106
    @Test
37758
3ecf9b414e05 8155774: move code from ModuleTestBase to toolbox
jjg
parents: 36778
diff changeset
   107
    public void testComplex_Fail(Path base) throws Exception {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   108
        Path src = getComplexSrc(base,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   109
                "import p5.C5; import p6.C6; import p7.C7;\n",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   110
                "C5 c5; C6 c6; C7 c7;\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   111
        Path classes = base.resolve("classes");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   112
        Files.createDirectories(classes);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   113
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
   114
        String log = new JavacTask(tb, Task.Mode.CMDLINE)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   115
                .options("-XDrawDiagnostics",
40308
274367a99f98 8136930: Simplify use of module-system options by custom launchers
jjg
parents: 37758
diff changeset
   116
                        "--module-source-path", src.toString())
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   117
                .files(findJavaFiles(src))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   118
                .outdir(classes)
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
   119
                .run(Task.Expect.FAIL)
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   120
                .writeAll()
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36526
diff changeset
   121
                .getOutput(Task.OutputKind.DIRECT);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   122
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   123
        String[] expect = {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   124
            "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   125
            "C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   126
            "C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   127
            "C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   128
                + "(compiler.misc.location: kindname.class, p1.C1, null)",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   129
            "C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   130
                + "(compiler.misc.location: kindname.class, p1.C1, null)",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   131
            "C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   132
                + "(compiler.misc.location: kindname.class, p1.C1, null)"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   133
        };
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   134
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   135
        for (String e: expect) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   136
            if (!log.contains(e))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   137
                throw new Exception("expected output not found: " + e);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   138
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   139
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   140
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   141
    /*
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   142
     * Set up the following module graph
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   143
     *     m1 -> m2 => m3 => m4 -> m5
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   144
     *              -> m6 => m7
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   145
     * where -> is requires, => is requires public
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   146
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    Path getComplexSrc(Path base, String m1_extraImports, String m1_extraUses) throws Exception {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   148
        Path src = base.resolve("src");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   149
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   150
        Path src_m1 = src.resolve("m1");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   151
        tb.writeJavaFiles(src_m1,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   152
                "module m1 { requires m2; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   153
                "package p1;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   154
                + "import p2.C2;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   155
                + "import p3.C3;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   156
                + "import p4.C4;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   157
                + m1_extraImports
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   158
                + "class C1 {\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   159
                + "  C2 c2; C3 c3; C4 c4;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   160
                + m1_extraUses
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   161
                + "}\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   162
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   163
        Path src_m2 = src.resolve("m2");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   164
        tb.writeJavaFiles(src_m2,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   165
                "module m2 {\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   166
                + "  requires public m3;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   167
                + "  requires        m6;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   168
                + "  exports p2;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   169
                + "}",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   170
                "package p2;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   171
                + "public class C2 { }\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   172
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   173
        Path src_m3 = src.resolve("m3");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        tb.writeJavaFiles(src_m3,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   175
                "module m3 { requires public m4; exports p3; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   176
                "package p3;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   177
                + "public class C3 { }\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   178
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   179
        Path src_m4 = src.resolve("m4");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   180
        tb.writeJavaFiles(src_m4,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   181
                "module m4 { requires m5; exports p4; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   182
                "package p4;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   183
                + "public class C4 { }\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   184
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   185
        Path src_m5 = src.resolve("m5");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   186
        tb.writeJavaFiles(src_m5,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   187
                "module m5 { exports p5; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   188
                "package p5;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   189
                + "public class C5 { }\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   190
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   191
        Path src_m6 = src.resolve("m6");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   192
        tb.writeJavaFiles(src_m6,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   193
                "module m6 { requires public m7; exports p6; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   194
                "package p6;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   195
                + "public class C6 { }\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   196
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   197
        Path src_m7 = src.resolve("m7");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   198
        tb.writeJavaFiles(src_m7,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   199
                "module m7 { exports p7; }",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   200
                "package p7;\n"
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   201
                + "public class C7 { }\n");
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   202
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
        return src;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   204
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   205
}