langtools/test/jdk/javadoc/tool/modules/Modules.java
author ksrini
Thu, 23 Mar 2017 14:18:25 -0700
changeset 44389 a745e6ff79a5
parent 44301 2f97c71f06f4
permissions -rw-r--r--
8176481: javadoc does not consider mandated modules Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     1
/*
44181
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     4
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     8
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    13
 * accompanied this code).
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    14
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    18
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    21
 * questions.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    22
 */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    23
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    24
/*
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    25
 * @test
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
    26
 * @bug 8159305 8166127 8175860 8176481
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    27
 * @summary Tests primarily the module graph computations.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    28
 * @modules
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    29
 *      jdk.javadoc/jdk.javadoc.internal.api
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    30
 *      jdk.javadoc/jdk.javadoc.internal.tool
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    31
 *      jdk.compiler/com.sun.tools.javac.api
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    32
 *      jdk.compiler/com.sun.tools.javac.main
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    33
 * @library /tools/lib
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    34
 * @build toolbox.ToolBox toolbox.TestRunner
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    35
 * @run main Modules
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    36
 */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    37
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    38
import java.io.IOException;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    39
import java.nio.file.Files;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    40
import java.nio.file.Path;
44181
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
    41
import java.nio.file.Paths;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    42
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    43
import toolbox.*;
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    44
import toolbox.Task.Expect;
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    45
import toolbox.Task.OutputKind;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    46
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    47
public class Modules extends ModuleTestBase {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    48
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    49
    public static void main(String... args) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    50
        new Modules().runTests();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    51
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    52
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    53
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    54
    public void testBasicMoption(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    55
        Files.createDirectory(base);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    56
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    57
        ModuleBuilder mb = new ModuleBuilder(tb, "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    58
        mb.comment("The first module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    59
                .exports("pub")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    60
                .classes("package pub; /** Class A */ public class A {}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    61
                .classes("package pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    62
                .write(src);
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    63
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    64
                 "--module", "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    65
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    66
        checkPackagesIncluded("pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    67
        checkTypesIncluded("pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    68
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    69
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    70
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    71
    public void testMultipleModulesOption1(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    72
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    73
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    74
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    75
        mb1.comment("The first module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    76
                .exports("m1pub")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    77
                .requires("m2")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    78
                .classes("package m1pub; /** Class A */ public class A {}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    79
                .classes("package m1pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    80
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    81
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    82
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    83
        mb2.comment("The second module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    84
                .exports("m2pub")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    85
                .classes("package m2pub; /** Class A */ public class A {}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    86
                .classes("package m2pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    87
                .write(src);
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    88
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    89
            "--module", "m1,m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    90
        checkModulesSpecified("m1", "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    91
        checkPackagesIncluded("m1pub", "m2pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    92
        checkTypesIncluded("m1pub.A", "m2pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    93
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    94
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    95
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    96
    @Test
44181
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
    97
    public void testMissingModuleWithSourcePath(Path base) throws Exception {
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
    98
        Path src = base.resolve("src");
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
    99
        Path mod = src.resolve("m1");
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   100
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   101
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   102
        mb1.comment("The first module.")
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   103
                .exports("m1pub")
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   104
                .requires("m2")
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   105
                .classes("package m1pub; /** Class A */ public class A {}")
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   106
                .classes("package m1pro; /** Class B */ public class B {}")
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   107
                .write(src);
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   108
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   109
        Path javafile = Paths.get(mod.toString(), "m1pub/A.java");
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   110
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   111
        execNegativeTask("--source-path", mod.toString(),
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   112
                javafile.toString());
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   113
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   114
        assertMessagePresent("error: cannot access module-info");
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   115
        assertMessageNotPresent("error - fatal error encountered");
44181
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   116
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   117
    }
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   118
2075fecdcce1 8175860: javadoc crashes with incorrect module sourcepath
ksrini
parents: 42407
diff changeset
   119
    @Test
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   120
    public void testMultipleModulesAggregatedModuleOption(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   121
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   122
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   123
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   124
        mb1.comment("The first module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   125
                .exports("m1pub")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   126
                .requires("m2")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   127
                .classes("package m1pub; /** Class A */ public class A {}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   128
                .classes("package m1pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   129
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   130
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   131
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   132
        mb2.comment("The second module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   133
                .exports("m2pub")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   134
                .classes("package m2pub; /** Class A */ public class A {}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   135
                .classes("package m2pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   136
                .write(src);
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   137
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   138
            "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   139
            "--module", "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   140
        checkModulesSpecified("m1", "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   141
        checkPackagesIncluded("m1pub", "m2pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   142
        checkTypesIncluded("m1pub.A", "m2pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   143
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   144
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   145
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   146
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   147
    public void testModulePathOption(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   148
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   149
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   150
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   151
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   152
        mb1.comment("Module on module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   153
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   154
                .classes("package pkg1; /** Class A */ public class A { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   155
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   156
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   157
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   158
        mb2.comment("The second module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   159
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   160
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   161
                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.A f; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   162
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   163
        execTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   164
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   165
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   166
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   167
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   168
        checkMembersSelected("pkg2.B.f");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   169
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   170
        // module path option "-p"
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   171
        execTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   172
                "-p", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   173
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   174
        // no module path
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   175
        execNegativeTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   176
                "--module", "m2");
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   177
        assertMessagePresent("error: module not found: m1");
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   178
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   179
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   180
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   181
    public void testUpgradeModulePathOption(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   182
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   183
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   184
        Path upgradePath = base.resolve("upgrades");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   185
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   186
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   187
        mb1.comment("Module on module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   188
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   189
                .classes("package pkg1; /** Class A */ public class A { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   190
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   191
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   192
        ModuleBuilder mbUpgrade = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   193
        mbUpgrade.comment("Module on upgrade module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   194
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   195
                .classes("package pkg1; /** Class C */ public class C { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   196
                .build(upgradePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   197
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   198
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   199
        mb2.comment("The second module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   200
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   201
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   202
                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.C f; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   203
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   204
        execTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   205
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   206
                "--upgrade-module-path", upgradePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   207
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   208
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   209
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   210
        checkMembersSelected("pkg2.B.f");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   211
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   212
        // no upgrade module path
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   213
        execNegativeTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   214
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   215
                "--module", "m2");
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   216
        assertMessagePresent("error: cannot find symbol");
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   217
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   218
        // dependency from module path
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   219
        ModuleBuilder mb3 = new ModuleBuilder(tb, "m3");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   220
        mb3.comment("The third module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   221
                .exports("pkg3")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   222
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   223
                .classes("package pkg3; /** Class Z */ public class Z { /** Field f */ public pkg1.A f; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   224
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   225
        execNegativeTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   226
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   227
                "--upgrade-module-path", upgradePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   228
                "--module", "m3");
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   229
        assertMessagePresent("Z.java:1: error: cannot find symbol");
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   230
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   231
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   232
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   233
    public void testAddModulesOption(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   234
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   235
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   236
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   237
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   238
        mb1.comment("Module on module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   239
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   240
                .classes("package pkg1; /** Class A */ public class A { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   241
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   242
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   243
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   244
        mb2.comment("The second module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   245
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   246
                .classes("package pkg2; /** @see pkg1.A */ public class B { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   247
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   248
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   249
        Path out = base.resolve("out-1");
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   250
        Files.createDirectories(out);
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   251
        String log = new JavadocTask(tb)
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   252
                .outdir(out)
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   253
                .options("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   254
                        "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   255
                        "--module", "m2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   256
                .run(Expect.FAIL)
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   257
                .writeAll()
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   258
                .getOutput(OutputKind.DIRECT);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   259
        if (!log.contains("B.java:1: error: reference not found")) {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   260
            throw new Exception("Error not found");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   261
        }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   262
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   263
        out = base.resolve("out-2");
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   264
        Files.createDirectories(out);
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   265
        new JavadocTask(tb)
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   266
                .outdir(out)
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   267
                .options("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   268
                        "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   269
                        "--add-modules", "m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   270
                        "--module", "m2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   271
                .run()
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   272
                .writeAll();
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   273
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   274
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   275
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   276
    public void testLimitModulesOption(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   277
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   278
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   279
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   280
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   281
        mb1.comment("Module on module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   282
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   283
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   284
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   285
        mb2.comment("The second module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   286
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   287
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   288
                .classes("package pkg2; /** Class B */ public class B { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   289
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   290
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   291
        execNegativeTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   292
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   293
                "--limit-modules", "java.base",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   294
                "--module", "m2");
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   295
        assertMessagePresent("error: module not found: m1");
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   296
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   297
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   298
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   299
    public void testAddExportsOption(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   300
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   301
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   302
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   303
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   304
        mb1.comment("Module on module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   305
                .classes("package pkg1; /** Class A */ public class A { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   306
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   307
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   308
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   309
        mb2.comment("The second module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   310
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   311
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   312
                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.A f; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   313
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   314
        execTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   315
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   316
                "--add-exports", "m1/pkg1=m2",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   317
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   318
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   319
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   320
        checkMembersSelected("pkg2.B.f");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   321
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   322
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41633
diff changeset
   323
    @Test
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   324
    public void testAddReadsOption(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   325
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   326
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   327
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   328
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   329
        mb1.comment("Module on module path.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   330
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   331
                .classes("package pkg1; /** Class A */ public class A {}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   332
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   333
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   334
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   335
        mb2.comment("The second module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   336
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   337
                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public pkg1.A f;}")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   338
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   339
        execTask("--module-source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   340
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   341
                "--add-modules", "m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   342
                "--add-reads", "m2=m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   343
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   344
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   345
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   346
        checkMembersSelected("pkg2.B.f");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   347
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   348
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   349
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   350
    public void testModuleOptionsWithLegacy(Path base) throws Exception {
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   351
        Files.createDirectory(base);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   352
        Path src = base.resolve("src");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   353
        Path classpath = base.resolve("classpath");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   354
        Path modulePath = base.resolve("modules");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   355
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   356
        tb.writeJavaFiles(classpath, "package pkg1; /** Class C */ public class C { }");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   357
        new JavacTask(tb)
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   358
                .files(classpath.resolve("pkg1/C.java"))
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   359
                .run();
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   360
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   361
        ModuleBuilder mb = new ModuleBuilder(tb, "m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   362
        mb.comment("The first module.")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   363
                .exports("pub")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   364
                .classes("package pub; /** Class M */ public class M { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   365
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   366
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   367
        tb.writeJavaFiles(src, "package pkg; /** Class L */ public class L { public pkg1.C f1; public pub.M f2; }");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   368
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   369
        execTask("--source-path", src.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   370
                "--class-path", classpath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   371
                "--module-path", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   372
                "--add-modules", "m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   373
                "pkg");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   374
        checkPackagesIncluded("pkg");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   375
        checkTypesIncluded("pkg.L");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   376
        checkMembersSelected("pkg.L.f1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   377
        checkMembersSelected("pkg.L.f2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   378
        assertAbsent("error", OutputKind.DIRECT);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   379
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   380
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   381
    /**
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   382
     * Tests diamond graph, inspired by javac diamond tests.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   383
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   384
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   385
     * Module M : test module, with variable requires
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   386
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   387
     * Module N :
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   388
     *     requires transitive O  --->   Module O:
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   389
     *                                   requires J   ---->   Module J:
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   390
     *                                   exports openO          exports openJ
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   391
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   392
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   393
     * Module L :
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   394
     *     requires transitive P  --->   Module P:
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   395
     *                                   exports openP
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   396
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   397
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   398
     */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   399
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   400
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   401
    public void testExpandRequiresNone(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   402
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   403
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   404
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   405
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   406
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   407
                .comment("The M module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   408
                .requires("N", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   409
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   410
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   411
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   412
                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   413
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   414
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   415
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   416
                "--module", "M");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   417
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   418
        checkModulesSpecified("M");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   419
        checkModulesIncluded("M");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   420
        checkPackagesIncluded("p");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   421
        checkTypesIncluded("p.Main");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   422
        checkPackagesNotIncluded(".*open.*");
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   423
        assertMessageNotPresent("warning");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   424
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   425
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   426
    @Test
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   427
    public void testExpandRequiresTransitive(Path base) throws Exception {
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   428
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   429
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   430
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   431
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   432
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   433
                .comment("The M module.")
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   434
                .requiresTransitive("N", src)
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   435
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   436
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   437
                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   438
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   439
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   440
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   441
                "--module", "M",
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   442
                "--expand-requires", "transitive");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   443
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   444
        checkModulesSpecified("M", "N", "O");
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   445
        checkModulesNotSpecified("java.base");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   446
        checkModulesIncluded("M", "N", "O");
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   447
        checkModulesNotIncluded("java.base");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   448
        checkPackagesIncluded("p", "openN", "openO");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   449
        checkTypesIncluded("p.Main", "openN.N", "openO.O");
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   450
        assertMessageNotPresent("warning");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   451
    }
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   452
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   453
    @Test
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   454
    public void testExpandRequiresTransitiveWithMandated(Path base) throws Exception {
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   455
        Path src = base.resolve("src");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   456
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   457
        createAuxiliaryModules(src);
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   458
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   459
        Path patchSrc = Paths.get(src.toString(), "patch");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   460
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   461
        new ModuleBuilder(tb, "M")
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   462
                .comment("The M module.")
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   463
                .requiresTransitive("N", src)
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   464
                .requires("L", src)
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   465
                .exports("p")
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   466
                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   467
                .write(src);
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   468
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   469
        // build the patching module
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   470
        tb.writeJavaFiles(patchSrc, "package pkg1;\n" +
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   471
                "/** Class A */ public class A extends java.util.ArrayList { }");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   472
        tb.writeJavaFiles(patchSrc, "package pkg1;\n"
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   473
                + "/** Class B */ public class B { }");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   474
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   475
        execTask("--module-source-path", src.toString(),
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   476
                "--patch-module", "java.base=" + patchSrc.toString(),
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   477
                "--module", "M",
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   478
                "--expand-requires", "transitive");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   479
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   480
        checkModulesSpecified("java.base", "M", "N", "O");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   481
        checkModulesIncluded("java.base", "M", "N", "O");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   482
        checkPackagesIncluded("p", "openN", "openO");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   483
        checkTypesIncluded("p.Main", "openN.N", "openO.O");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   484
        assertMessageNotPresent("warning");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   485
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   486
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   487
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   488
    public void testExpandRequiresAll(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   489
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   490
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   491
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   492
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   493
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   494
                .comment("The M module.")
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   495
                .requiresTransitive("N", src)
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   496
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   497
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   498
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   499
                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   500
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   501
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   502
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   503
                "--module", "M",
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 41161
diff changeset
   504
                "--expand-requires", "all");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   505
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   506
        checkModulesSpecified("M", "N", "L", "O");
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   507
        checkModulesIncluded("M", "N", "L", "O");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   508
        checkModulesNotIncluded("P", "J", "Q");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   509
        checkPackagesIncluded("p", "openN", "openL", "openO");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   510
        checkPackagesNotIncluded(".*openP.*", ".*openJ.*");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   511
        checkTypesIncluded("p.Main", "openN.N", "openL.L", "openO.O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   512
        checkTypesNotIncluded(".*openP.*", ".*openJ.*");
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   513
        assertMessageNotPresent("warning");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   514
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   515
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   516
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   517
    public void testMissingModule(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   518
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   519
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   520
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   521
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   522
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   523
                .comment("The M module.")
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   524
                .requiresTransitive("N", src)
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   525
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   526
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   527
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   528
                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   529
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   530
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   531
        execNegativeTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   532
                "--module", "MIA",
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 41161
diff changeset
   533
                "--expand-requires", "all");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   534
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   535
        assertMessagePresent("javadoc: error - module MIA not found.");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   536
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   537
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   538
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   539
    public void testMissingModuleMultiModuleCmdline(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   540
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   541
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   542
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   543
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   544
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   545
                .comment("The M module.")
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   546
                .requiresTransitive("N", src)
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   547
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   548
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   549
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   550
                .classes("package p; public class Main { openO.O o; openN.N n; openL.L l; }")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   551
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   552
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   553
        execNegativeTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   554
                "--module", "M,N,L,MIA,O,P",
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 41161
diff changeset
   555
                "--expand-requires", "all");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   556
44288
c33a416cfcf8 8176539: javadoc ignores module-info files on the command line
ksrini
parents: 44181
diff changeset
   557
        assertMessagePresent("javadoc: error - module MIA not found");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   558
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   559
44301
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   560
    @Test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   561
    public void testSingleModuleOptionWithSourcePath(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   562
        Path src = base.resolve("src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   563
        Path mod = createSimpleModule(src, "m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   564
        execTask("--source-path", mod.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   565
                 "--module", "m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   566
        checkModulesSpecified("m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   567
        checkPackagesIncluded("p");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   568
        checkTypesIncluded("p.C");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   569
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   570
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   571
    @Test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   572
    public void testSingleModuleOptionWithMissingModuleInSourcePath(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   573
        Path src = base.resolve("src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   574
        Path mod = createSimpleModule(src, "m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   575
        execNegativeTask("--source-path", mod.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   576
                 "--module", "m2");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   577
        assertMessagePresent("source path does not contain module m2");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   578
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   579
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   580
    @Test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   581
    public void testMultipleModuleOptionWithSourcePath(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   582
        Path src = base.resolve("src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   583
        Path mod = createSimpleModule(src, "m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   584
        execNegativeTask("--source-path", mod.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   585
                 "--module", "m1,m2,m3");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   586
        assertMessagePresent("cannot use source path for multiple modules m1, m2, m3");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   587
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   588
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   589
    @Test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   590
    public void testSingleModuleOptionWithNoModuleOnSourcePath(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   591
        Path src = base.resolve("src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   592
        Path mod1 = Paths.get(src.toString(), "m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   593
        execNegativeTask("--source-path", mod1.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   594
                 "--module", "m1");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   595
        assertMessagePresent("module m1 not found on source path");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   596
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   597
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   598
    Path createSimpleModule(Path src, String mname) throws IOException {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   599
        Path mpath = Paths.get(src.toString(), mname);
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   600
        tb.writeJavaFiles(mpath,
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   601
                "module " + mname + " { exports p; }",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   602
                "package p; public class C { }");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   603
        return mpath;
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   604
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents: 44288
diff changeset
   605
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   606
    void createAuxiliaryModules(Path src) throws IOException {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   607
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   608
        new ModuleBuilder(tb, "J")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   609
                .comment("The J module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   610
                .exports("openJ")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   611
                .classes("package openJ;  /** Class J open. */ public class J { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   612
                .classes("package closedJ; /** Class J closed. */ public class J  { }")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   613
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   614
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   615
        new ModuleBuilder(tb, "L")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   616
                .comment("The L module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   617
                .exports("openL")
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   618
                .requiresTransitive("P")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   619
                .classes("package openL; /** Class L open */ public class L { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   620
                .classes("package closedL;  /** Class L closed */ public class L { }")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   621
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   622
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   623
        new ModuleBuilder(tb, "N")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   624
                .comment("The N module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   625
                .exports("openN")
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41990
diff changeset
   626
                .requiresTransitive("O")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   627
                .classes("package openN; /** Class N open */ public class N  { }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   628
                .classes("package closedN; /** Class N closed */ public class N { }")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   629
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   630
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   631
        new ModuleBuilder(tb, "O")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   632
                .comment("The O module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   633
                .exports("openO")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   634
                .requires("J")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   635
                .classes("package openO; /** Class O open. */ public class O { openJ.J j; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   636
                .classes("package closedO;  /** Class O closed. */ public class O { }")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   637
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   638
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   639
        new ModuleBuilder(tb, "P")
44389
a745e6ff79a5 8176481: javadoc does not consider mandated modules
ksrini
parents: 44301
diff changeset
   640
                .comment("The P module.")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   641
                .exports("openP")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   642
                .requires("J")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   643
                .classes("package openP; /** Class O open. */ public class O { openJ.J j; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   644
                .classes("package closedP;  /** Class O closed. */ public class O { }")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   645
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   646
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   647
        new ModuleBuilder(tb, "Q")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   648
                .comment("The Q module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   649
                .exports("openQ")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   650
                .requires("J")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   651
                .classes("package openQ; /** Class Q open. */ public class Q { openJ.J j; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   652
                .classes("package closedQ;  /** Class Q closed. */ public class Q { }")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   653
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   654
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   655
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   656
}