test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithAutomaticModule.java
author jjg
Tue, 15 Jan 2019 11:05:25 -0800
changeset 53310 8ce4083fc831
child 53341 c79189826bbb
permissions -rw-r--r--
8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module." Reviewed-by: hannesw, pmuthuswamy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53310
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     1
/*
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     4
 *
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     8
 *
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    13
 * accompanied this code).
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    14
 *
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    18
 *
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    21
 * questions.
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    22
 */
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    23
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    24
/*
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    25
 * @test
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    26
 * @bug 8212233
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    27
 * @summary The code being documented uses modules but the packages defined in $URL are in the unnamed module.
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    28
 * @library /tools/lib ../lib
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    29
 * @modules
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    30
 *      jdk.javadoc/jdk.javadoc.internal.tool
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    31
 *      jdk.compiler/com.sun.tools.javac.api
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    32
 *      jdk.compiler/com.sun.tools.javac.main
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    33
 * @build JavadocTester toolbox.JarTask toolbox.JavacTask toolbox.ModuleBuilder toolbox.ToolBox
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    34
 * @run main TestLinkOptionWithAutomaticModule
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    35
 */
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    36
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    37
import java.io.IOException;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    38
import java.nio.file.Files;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    39
import java.nio.file.Path;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    40
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    41
import toolbox.JarTask;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    42
import toolbox.JavacTask;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    43
import toolbox.ModuleBuilder;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    44
import toolbox.ToolBox;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    45
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    46
public class TestLinkOptionWithAutomaticModule extends JavadocTester {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    47
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    48
    public static void main(String... args) throws Exception {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    49
        TestLinkOptionWithAutomaticModule tester = new TestLinkOptionWithAutomaticModule();
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    50
        tester.runTests(m -> new Object[]{ Path.of(m.getName()) });
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    51
    }
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    52
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    53
    final ToolBox tb = new ToolBox();
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    54
    private Path libJar;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    55
    private Path libAPI;
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    56
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    57
    TestLinkOptionWithAutomaticModule() throws IOException {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    58
        initLib();
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    59
    }
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    60
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    61
    private void initLib() throws IOException {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    62
        // create library: write source, compile it, jar it
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    63
        Path lib = Path.of("lib");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    64
        Path libSrc = lib.resolve("src");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    65
        tb.writeJavaFiles(libSrc, "package lib; public class LibClass { }");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    66
        Path libClasses = Files.createDirectories(lib.resolve("classes"));
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    67
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    68
        new JavacTask(tb)
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    69
                .outdir(libClasses)
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    70
                .files(tb.findJavaFiles(libSrc))
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    71
                .run()
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    72
                .writeAll();
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    73
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    74
        libJar = lib.resolve("MyLib.jar");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    75
        new JarTask(tb, libJar)
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    76
                .baseDir(libClasses)
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    77
                .files(".")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    78
                .run();
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    79
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    80
        libAPI = lib.resolve("api");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    81
        javadoc("-d", libAPI.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    82
                "-sourcepath", libSrc.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    83
                "lib");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    84
        checkExit(Exit.OK);
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    85
    }
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    86
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    87
    @Test
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    88
    public void testLinkUnnamedToAutomaticModule(Path base) throws IOException {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    89
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    90
        // create API referring to library
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    91
        Path src = base.resolve("src");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    92
        tb.writeJavaFiles(src, "package p; public class MyClass extends lib.LibClass { }");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    93
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    94
        // run javadoc with library as automatic module
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    95
        Path api = base.resolve("api");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    96
        javadoc("-d", api.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    97
                "-sourcepath", src.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    98
                "--add-modules", "MyLib",
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
    99
                "--module-path", libJar.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   100
                "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   101
                "p");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   102
        checkExit(Exit.OK);
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   103
        checkOutput("p/MyClass.html", true,
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   104
                "extends <a href=\"http://myWebsite/lib/LibClass.html?is-external=true\" "
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   105
                + "title=\"class or interface in lib\" class=\"externalLink\">LibClass</a>");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   106
    }
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   107
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   108
    @Test
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   109
    public void testLinkNamedToAutomaticModule(Path base) throws IOException {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   110
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   111
        // create API referring to library
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   112
        Path src = base.resolve("src");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   113
        new ModuleBuilder(tb, "my.module")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   114
                .exports("p")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   115
                .requires("MyLib")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   116
                .classes("package p; public class MyClass extends lib.LibClass { }")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   117
                .write(src);
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   118
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   119
        // run javadoc with library as automatic module
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   120
        Path api = base.resolve("api");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   121
        javadoc("-d", api.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   122
                "--module-source-path", src.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   123
                "--module-path", libJar.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   124
                "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   125
                "--module", "my.module");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   126
        checkExit(Exit.OK);
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   127
        checkOutput("my.module/p/MyClass.html", true,
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   128
                "extends <a href=\"http://myWebsite/lib/LibClass.html?is-external=true\" "
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   129
                + "title=\"class or interface in lib\" class=\"externalLink\">LibClass</a>");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   130
    }
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   131
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   132
    @Test
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   133
    public void testLinkNamedToUnnamedModule(Path base) throws IOException {
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   134
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   135
        // create API referring to library
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   136
        Path src = base.resolve("src");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   137
        new ModuleBuilder(tb, "my.module")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   138
                .exports("p")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   139
                .classes("package p; public class MyClass extends lib.LibClass { }")
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   140
                .write(src);
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   141
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   142
        // run javadoc with library as unnamed module
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   143
        Path api = base.resolve("api");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   144
        javadoc("-d", api.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   145
                "--module-source-path", src.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   146
                "--add-reads", "my.module=ALL-UNNAMED",
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   147
                "--class-path", libJar.toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   148
                "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(),
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   149
                "--module", "my.module");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   150
        checkExit(Exit.OK);
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   151
        checkOutput("my.module/p/MyClass.html", true,
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   152
                "extends <a href=\"http://myWebsite/lib/LibClass.html?is-external=true\" "
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   153
                + "title=\"class or interface in lib\" class=\"externalLink\">LibClass</a>");
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   154
    }
8ce4083fc831 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."
jjg
parents:
diff changeset
   155
}