langtools/test/jdk/javadoc/tool/modules/Modules.java
author ksrini
Tue, 08 Nov 2016 12:56:17 -0800
changeset 41990 ffaf4e59538a
parent 41633 eec0f5b0465f
child 42407 f3702cff2933
permissions -rw-r--r--
8166379: IAE while invoking javadoc with --patch-module 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
/*
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    26
 * @bug 8159305 8166127
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;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    41
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    42
import toolbox.*;
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    43
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
    44
import toolbox.Task.OutputKind;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    45
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    46
public class Modules extends ModuleTestBase {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    47
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    48
    public static void main(String... args) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    49
        new Modules().runTests();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    50
    }
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
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    53
    public void testBasicMoption(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    54
        Files.createDirectory(base);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    55
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    56
        ModuleBuilder mb = new ModuleBuilder(tb, "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    57
        mb.comment("The first module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    58
                .exports("pub")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    59
                .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
    60
                .classes("package pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    61
                .write(src);
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    62
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    63
                 "--module", "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    64
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    65
        checkPackagesIncluded("pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    66
        checkTypesIncluded("pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    67
    }
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
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    70
    public void testMultipleModulesOption1(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    71
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    72
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    73
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    74
        mb1.comment("The first module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    75
                .exports("m1pub")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    76
                .requires("m2")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    77
                .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
    78
                .classes("package m1pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    79
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    80
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    81
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    82
        mb2.comment("The second module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    83
                .exports("m2pub")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
    84
                .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
    85
                .classes("package m2pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    86
                .write(src);
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    87
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    88
            "--module", "m1,m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    89
        checkModulesSpecified("m1", "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    90
        checkPackagesIncluded("m1pub", "m2pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    91
        checkTypesIncluded("m1pub.A", "m2pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    92
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
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    96
    public void testMultipleModulesAggregatedModuleOption(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    97
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    98
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    99
        ModuleBuilder mb1 = new ModuleBuilder(tb, "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   100
        mb1.comment("The first module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   101
                .exports("m1pub")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   102
                .requires("m2")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   103
                .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
   104
                .classes("package m1pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   105
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   106
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   107
        ModuleBuilder mb2 = new ModuleBuilder(tb, "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   108
        mb2.comment("The second module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   109
                .exports("m2pub")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   110
                .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
   111
                .classes("package m2pro; /** Class B */ public class B {}")
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   112
                .write(src);
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   113
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   114
            "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   115
            "--module", "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   116
        checkModulesSpecified("m1", "m2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   117
        checkPackagesIncluded("m1pub", "m2pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   118
        checkTypesIncluded("m1pub.A", "m2pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   119
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   120
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   121
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   122
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   123
    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
   124
        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
   125
        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
   126
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   127
        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
   128
        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
   129
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   130
                .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
   131
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   132
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   133
        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
   134
        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
   135
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   136
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   137
                .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
   138
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   139
        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
   140
                "--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
   141
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   142
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   143
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   144
        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
   145
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   146
        // 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
   147
        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
   148
                "-p", modulePath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   149
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   150
        // no module path
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   151
        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
   152
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   153
        assertErrorPresent("error: module not found: m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   154
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   155
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   156
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   157
    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
   158
        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
   159
        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
   160
        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
   161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   162
        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
   163
        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
   164
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   165
                .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
   166
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   167
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   168
        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
   169
        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
   170
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   171
                .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
   172
                .build(upgradePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   173
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   174
        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
   175
        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
   176
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   177
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   178
                .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
   179
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   180
        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
   181
                "--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
   182
                "--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
   183
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   184
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   185
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   186
        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
   187
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   188
        // 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
   189
        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
   190
                "--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
   191
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   192
        assertErrorPresent("error: cannot find symbol");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   193
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   194
        // 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
   195
        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
   196
        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
   197
                .exports("pkg3")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   198
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   199
                .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
   200
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   201
        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
   202
                "--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
   203
                "--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
   204
                "--module", "m3");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   205
        assertErrorPresent("Z.java:1: error: cannot find symbol");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   206
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   207
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   208
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   209
    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
   210
        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
   211
        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
   212
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   213
        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
   214
        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
   215
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   216
                .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
   217
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   218
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   219
        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
   220
        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
   221
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   222
                .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
   223
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   224
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   225
        Path out = base.resolve("out-1");
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   226
        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
   227
        String log = new JavadocTask(tb)
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   228
                .outdir(out)
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   229
                .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
   230
                        "--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
   231
                        "--module", "m2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   232
                .run(Expect.FAIL)
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   233
                .writeAll()
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   234
                .getOutput(OutputKind.DIRECT);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   235
        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
   236
            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
   237
        }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   238
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   239
        out = base.resolve("out-2");
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   240
        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
   241
        new JavadocTask(tb)
41633
eec0f5b0465f 8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents: 41252
diff changeset
   242
                .outdir(out)
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   243
                .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
   244
                        "--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
   245
                        "--add-modules", "m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   246
                        "--module", "m2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   247
                .run()
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   248
                .writeAll();
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   249
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   250
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   251
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   252
    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
   253
        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
   254
        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
   255
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   256
        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
   257
        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
   258
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   259
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   260
        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
   261
        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
   262
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   263
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   264
                .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
   265
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   266
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   267
        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
   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
                "--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
   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
        assertErrorPresent("error: module not found: m1");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   272
    }
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
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   275
    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
   276
        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
   277
        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
   278
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   279
        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
   280
        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
   281
                .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
   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 { /** 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
   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
        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
   291
                "--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
   292
                "--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
   293
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   294
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   295
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   296
        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
   297
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   298
41990
ffaf4e59538a 8166379: IAE while invoking javadoc with --patch-module
ksrini
parents: 41633
diff changeset
   299
    @Test
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   300
    public void testPatchModuleOption(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
   301
        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
   302
        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
   303
        Path patchPath = base.resolve("patch");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   304
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   305
        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
   306
        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
   307
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   308
                .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
   309
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   310
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   311
        tb.writeJavaFiles(patchPath, "package pkg1; /** Class A */ public class A { public static int k; }");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   312
        new JavacTask(tb)
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   313
                .files(patchPath.resolve("pkg1/A.java"))
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   314
                .run();
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   315
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   316
        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
   317
        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
   318
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   319
                .requires("m1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   320
                .classes("package pkg2; /** Class B */ public class B { /** Field f */ public int f = pkg1.A.k; }")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   321
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   322
        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
   323
                "--patch-module", "m1=" + patchPath.toString(),
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   324
                "--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
   325
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   326
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   327
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   328
        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
   329
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   330
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   331
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   332
    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
   333
        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
   334
        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
   335
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   336
        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
   337
        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
   338
                .exports("pkg1")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   339
                .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
   340
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   341
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   342
        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
   343
        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
   344
                .exports("pkg2")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   345
                .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
   346
                .write(src);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   347
        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
   348
                "--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
   349
                "--add-modules", "m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   350
                "--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
   351
                "--module", "m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   352
        checkModulesSpecified("m2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   353
        checkPackagesIncluded("pkg2");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   354
        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
   355
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   356
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   357
    @Test
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   358
    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
   359
        Files.createDirectory(base);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   360
        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
   361
        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
   362
        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
   363
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   364
        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
   365
        new JavacTask(tb)
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   366
                .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
   367
                .run();
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
        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
   370
        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
   371
                .exports("pub")
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   372
                .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
   373
                .build(modulePath);
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   374
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   375
        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
   376
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   377
        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
   378
                "--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
   379
                "--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
   380
                "--add-modules", "m1",
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   381
                "pkg");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   382
        checkPackagesIncluded("pkg");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   383
        checkTypesIncluded("pkg.L");
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   384
        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
   385
        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
   386
        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
   387
    }
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   388
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   389
    /**
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   390
     * Tests diamond graph, inspired by javac diamond tests.
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 M : test module, with variable requires
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   394
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   395
     * Module N :
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   396
     *     requires public O  --->   Module O:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   397
     *                                 requires J   ---->   Module J:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   398
     *                                 exports openO          exports openJ
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
     *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   401
     * Module L :
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   402
     *     requires public P  --->   Module P:
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   403
     *                                 exports openP
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   404
     *
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
     */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   407
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   408
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   409
    public void testExpandRequiresNone(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   410
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   411
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   412
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   413
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   414
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   415
                .comment("The M module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   416
                .requires("N", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   417
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   418
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   419
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   420
                .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
   421
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   422
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   423
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   424
                "--module", "M");
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
        checkModulesSpecified("M");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   427
        checkModulesIncluded("M");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   428
        checkPackagesIncluded("p");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   429
        checkTypesIncluded("p.Main");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   430
        checkPackagesNotIncluded(".*open.*");
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
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   433
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   434
    public void testExpandRequiresPublic(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   435
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   436
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   437
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   438
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   439
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   440
                .comment("The M module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   441
                .requiresPublic("N", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   442
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   443
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   444
                .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
   445
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   446
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   447
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   448
                "--module", "M",
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 41161
diff changeset
   449
                "--expand-requires", "public");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   450
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   451
        checkModulesSpecified("M", "N", "O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   452
        checkModulesIncluded("M", "N", "O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   453
        checkPackagesIncluded("p", "openN", "openO");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   454
        checkTypesIncluded("p.Main", "openN.N", "openO.O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   455
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   456
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   457
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   458
    public void testExpandRequiresAll(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   459
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   460
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   461
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   462
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   463
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   464
                .comment("The M module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   465
                .requiresPublic("N", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   466
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   467
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   468
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   469
                .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
   470
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   471
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   472
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   473
                "--module", "M",
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 41161
diff changeset
   474
                "--expand-requires", "all");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   475
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   476
        checkModulesSpecified("M", "java.base", "N", "L", "O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   477
        checkModulesIncluded("M", "java.base", "N", "L", "O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   478
        checkModulesNotIncluded("P", "J", "Q");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   479
        checkPackagesIncluded("p", "openN", "openL", "openO");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   480
        checkPackagesNotIncluded(".*openP.*", ".*openJ.*");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   481
        checkTypesIncluded("p.Main", "openN.N", "openL.L", "openO.O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   482
        checkTypesNotIncluded(".*openP.*", ".*openJ.*");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   483
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   484
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   485
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   486
    public void testMissingModule(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   487
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   488
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   489
        createAuxiliaryModules(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
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   492
                .comment("The M module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   493
                .requiresPublic("N", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   494
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   495
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   496
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   497
                .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
   498
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   499
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   500
        execNegativeTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   501
                "--module", "MIA",
41252
058d83c9b1c7 8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents: 41161
diff changeset
   502
                "--expand-requires", "all");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   503
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   504
        assertErrorPresent("javadoc: error - module MIA not found.");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   505
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   506
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   507
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   508
    public void testMissingModuleMultiModuleCmdline(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   509
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   510
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   511
        createAuxiliaryModules(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   512
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   513
        new ModuleBuilder(tb, "M")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   514
                .comment("The M module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   515
                .requiresPublic("N", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   516
                .requires("L", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   517
                .requires("O", src)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   518
                .exports("p")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   519
                .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
   520
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   521
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   522
        execNegativeTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   523
                "--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
   524
                "--expand-requires", "all");
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   525
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   526
        assertErrorPresent("javadoc: error - module MIA not found");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   527
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   528
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   529
    void createAuxiliaryModules(Path src) throws IOException {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   530
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   531
        new ModuleBuilder(tb, "J")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   532
                .comment("The J module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   533
                .exports("openJ")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   534
                .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
   535
                .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
   536
                .write(src);
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
        new ModuleBuilder(tb, "L")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   539
                .comment("The L module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   540
                .exports("openL")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   541
                .requiresPublic("P")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   542
                .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
   543
                .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
   544
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   545
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   546
        new ModuleBuilder(tb, "N")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   547
                .comment("The N module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   548
                .exports("openN")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   549
                .requiresPublic("O")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   550
                .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
   551
                .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
   552
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   553
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   554
        new ModuleBuilder(tb, "O")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   555
                .comment("The O module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   556
                .exports("openO")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   557
                .requires("J")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   558
                .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
   559
                .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
   560
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   561
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   562
        new ModuleBuilder(tb, "P")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   563
                .comment("The O module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   564
                .exports("openP")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   565
                .requires("J")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   566
                .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
   567
                .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
   568
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   569
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   570
        new ModuleBuilder(tb, "Q")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   571
                .comment("The Q module.")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   572
                .exports("openQ")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   573
                .requires("J")
41161
c73ab5e71cc2 8166127: Develop new tests to cover javadoc module options which are passed to underlying javac
ksrini
parents: 40599
diff changeset
   574
                .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
   575
                .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
   576
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   577
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   578
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   579
}