author | jjg |
Wed, 13 Feb 2019 17:18:56 -0800 | |
changeset 53748 | 2d5023bad20a |
parent 53562 | 0d9dee001667 |
child 53754 | bc8fb1fa55b5 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
2 |
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5520 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
10 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
49139
diff
changeset
|
26 |
* @bug 4720957 5020118 8026567 8038976 8184969 8164407 8182765 8205593 |
10 | 27 |
* @summary Test to make sure that -link and -linkoffline link to |
23974
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
28 |
* right files, and URLs with and without trailing slash are accepted. |
10 | 29 |
* @author jamieh |
53097 | 30 |
* @library ../../lib |
36526 | 31 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
53097 | 32 |
* @build javadoc.tester.* |
10 | 33 |
* @run main TestLinkOption |
34 |
*/ |
|
35 |
||
23974
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
36 |
import java.io.File; |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
37 |
|
53097 | 38 |
import javadoc.tester.JavadocTester; |
39 |
||
10 | 40 |
public class TestLinkOption extends JavadocTester { |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
41 |
/** |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
42 |
* The entry point of the test. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
43 |
* @param args the array of command line arguments. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
44 |
*/ |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
45 |
public static void main(String... args) throws Exception { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
46 |
TestLinkOption tester = new TestLinkOption(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
47 |
tester.runTests(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
48 |
} |
10 | 49 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
50 |
// The following test runs javadoc multiple times; it is important that the |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
51 |
// first one is run first, since the subsequent runs refer to the output |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
52 |
// it generates. Therefore we run everything serially in a single @Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
53 |
// method and not in independent @Test methods. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
54 |
@Test |
53097 | 55 |
public void test() { |
36526 | 56 |
String mylib = "mylib"; |
57 |
String[] javacArgs = { |
|
58 |
"-d", mylib, testSrc + "/extra/StringBuilder.java" |
|
59 |
}; |
|
60 |
com.sun.tools.javac.Main.compile(javacArgs); |
|
61 |
||
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
62 |
// Generate the documentation using -linkoffline and a URL as the first parameter. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
63 |
String out1 = "out1"; |
36526 | 64 |
String url = "http://acme.com/jdk/"; |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
65 |
javadoc("-d", out1, |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
49139
diff
changeset
|
66 |
"-source", "8", |
36526 | 67 |
"-classpath", mylib, |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
68 |
"-sourcepath", testSrc, |
36526 | 69 |
"-linkoffline", url, testSrc + "/jdk", |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
70 |
"-package", |
36526 | 71 |
"pkg", "mylib.lang"); |
49139
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48654
diff
changeset
|
72 |
checkExit(Exit.ERROR); |
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48654
diff
changeset
|
73 |
checkOutput(Output.OUT, true, |
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48654
diff
changeset
|
74 |
"tag not supported in the generated HTML version: tt"); |
10 | 75 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
76 |
checkOutput("pkg/C.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
77 |
"<a href=\"" + url + "java/lang/String.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
78 |
+ "title=\"class or interface in java.lang\" class=\"externalLink\"><code>Link to String Class</code></a>", |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
79 |
//Make sure the parameters are indented properly when the -link option is used. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
80 |
"(int p1,\n" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
81 |
+ " int p2,\n" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
82 |
+ " int p3)", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
83 |
"(int p1,\n" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
84 |
+ " int p2,\n" |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
85 |
+ " <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\" class=\"externalLink\">" |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
86 |
+ "Object</a> p3)"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
87 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
88 |
checkOutput("pkg/B.html", true, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
89 |
"<div class=\"block\">A method with html tag the method " |
49139
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48654
diff
changeset
|
90 |
+ "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader()\"" |
53748 | 91 |
+ " title=\"class or interface in java.lang\" class=\"externalLink\"><code><b>getSystemClassLoader()</b>" |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
92 |
+ "</code></a> as the parent class loader.</div>", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
93 |
"<div class=\"block\">is equivalent to invoking <code>" |
49139
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48654
diff
changeset
|
94 |
+ "<a href=\"#createTempFile(java.lang.String,java.lang.String,java.io.File)\">" |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
95 |
+ "<code>createTempFile(prefix, suffix, null)</code></a></code>.</div>", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
96 |
"<a href=\"" + url + "java/lang/String.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
97 |
+ "title=\"class or interface in java.lang\" class=\"externalLink\">Link-Plain to String Class</a>", |
53748 | 98 |
"<code><b>getSystemClassLoader()</b></code>", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
99 |
"<code>createTempFile(prefix, suffix, null)</code>", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
100 |
"<dd><a href=\"http://www.ietf.org/rfc/rfc2279.txt\"><i>RFC 2279: UTF-8, a\n" + |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
101 |
" transformation format of ISO 10646</i></a>, <br><a " + |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
102 |
"href=\"http://www.ietf.org/rfc/rfc2373.txt\"><i>RFC 2373: IPv6 Addressing\n" + |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
103 |
" Architecture</i></a>, <br><a href=\"http://www.ietf.org/rfc/rfc2396.txt\">" + |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
104 |
"<i>RFC 2396: Uniform\n" + |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
105 |
" Resource Identifiers (URI): Generic Syntax</i></a>, " + |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
106 |
"<br><a href=\"http://www.ietf.org/rfc/rfc2732.txt\"><i>RFC 2732: Format for\n" + |
53558
fc5a68ff2c0b
8217773: Test langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java fails after JDK-8217034
jjg
parents:
53391
diff
changeset
|
107 |
" Literal IPv6 Addresses in URLs</i></a>, <br><a href=\"C.html\">" + |
fc5a68ff2c0b
8217773: Test langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java fails after JDK-8217034
jjg
parents:
53391
diff
changeset
|
108 |
"A nearby file</a></dd>\n" + |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
109 |
"</dl>"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
110 |
|
36526 | 111 |
checkOutput("mylib/lang/StringBuilderChild.html", true, |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
112 |
"<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
113 |
+ "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
114 |
+ "title=\"class or interface in java.lang\" class=\"externalLink\">Object</a></pre>" |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
115 |
); |
10 | 116 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
117 |
// Generate the documentation using -linkoffline and a relative path as the first parameter. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
118 |
// We will try linking to the docs generated in test 1 with a relative path. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
119 |
String out2 = "out2"; |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
120 |
javadoc("-d", out2, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
121 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
122 |
"-linkoffline", "../" + out1, out1, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
123 |
"-package", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
124 |
"pkg2"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
125 |
checkExit(Exit.OK); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
126 |
checkOutput("pkg2/C2.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
127 |
"This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " + |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
128 |
"title=\"class or interface in pkg\" class=\"externalLink\"><code>Class C</code></a>." |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
129 |
); |
10 | 130 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
131 |
String out3 = "out3"; |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
132 |
javadoc(createArguments(out3, out1, true)); // with trailing slash |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
133 |
checkExit(Exit.OK); |
10 | 134 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
135 |
String out4 = "out4"; |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
136 |
javadoc(createArguments(out4, out1, false)); // without trailing slash |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
137 |
checkExit(Exit.OK); |
36526 | 138 |
// Note: the following test is very weak, and will fail if ever the text |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
139 |
// of the message is changed. We should have a separate test to verify |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
140 |
// this is the text that is given when there is a problem with a URL |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
141 |
checkOutput(Output.OUT, false, |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
142 |
"warning - Error fetching URL"); |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
143 |
|
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
144 |
// check multiple link options |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
145 |
javadoc("-d", "out5", |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
146 |
"-sourcepath", testSrc, |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
147 |
"-link", "../" + "out1", |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
148 |
"-link", "../" + "out2", |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
149 |
"pkg3"); |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
150 |
checkExit(Exit.OK); |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
151 |
checkOutput("pkg3/A.html", true, |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
152 |
"<pre>public class <span class=\"typeNameLabel\">A</span>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
153 |
+ "extends java.lang.Object</pre>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
154 |
+ "<div class=\"block\">Test links.\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
155 |
+ " <br>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
156 |
+ " <a href=\"../../out2/pkg2/C2.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
157 |
+ "title=\"class or interface in pkg2\" class=\"externalLink\"><code>link to pkg2.C2</code></a>\n" |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
158 |
+ " <br>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
159 |
+ " <a href=\"../../out1/mylib/lang/StringBuilderChild.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
160 |
+ "title=\"class or interface in mylib.lang\" class=\"externalLink\">" |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
161 |
+ "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
162 |
); |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
163 |
|
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
164 |
// check multiple linkoffline options |
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
165 |
setAutomaticCheckLinks(false); // The example code has toy/bad links |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
166 |
javadoc("-d", "out6", |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
167 |
"-sourcepath", testSrc, |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
168 |
"-linkoffline", "../copy/out1", "out1", |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
169 |
"-linkoffline", "../copy/out2", "out2", |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
170 |
"pkg3"); |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
171 |
checkExit(Exit.OK); |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
172 |
checkOutput("pkg3/A.html", true, |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
173 |
"<pre>public class <span class=\"typeNameLabel\">A</span>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
174 |
+ "extends java.lang.Object</pre>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
175 |
+ "<div class=\"block\">Test links.\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
176 |
+ " <br>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
177 |
+ " <a href=\"../../copy/out2/pkg2/C2.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
178 |
+ "title=\"class or interface in pkg2\" class=\"externalLink\"><code>link to pkg2.C2</code></a>\n" |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
179 |
+ " <br>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
180 |
+ " <a href=\"../../copy/out1/mylib/lang/StringBuilderChild.html?is-external=true\" " |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
47216
diff
changeset
|
181 |
+ "title=\"class or interface in mylib.lang\" class=\"externalLink\">" |
46079
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
182 |
+ "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n" |
059faa5e1267
8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents:
36526
diff
changeset
|
183 |
); |
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
184 |
|
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
185 |
setAutomaticCheckLinks(true); // re-enable checks |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
186 |
} |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
187 |
|
23974
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
188 |
/* |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
189 |
* Create the documentation using the -link option, vary the behavior with |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
190 |
* both trailing and no trailing slash. We are only interested in ensuring |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
191 |
* that the command executes with no errors or related warnings. |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
192 |
*/ |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
193 |
static String[] createArguments(String outDir, String packageDir, boolean withTrailingSlash) { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
194 |
String packagePath = new File(packageDir).getAbsolutePath(); |
23974
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
195 |
if (withTrailingSlash) { |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
196 |
// add the trailing slash, if it is not present! |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
197 |
if (!packagePath.endsWith(FS)) { |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
198 |
packagePath = packagePath + FS; |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
199 |
} |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
200 |
} else { |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
201 |
// remove the trailing slash, if it is present! |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
202 |
if (packagePath.endsWith(FS)) { |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
203 |
packagePath = packagePath.substring(0, packagePath.length() - 1); |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
204 |
} |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
205 |
} |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
206 |
String args[] = { |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
207 |
"-d", outDir, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
208 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
209 |
"-link", "file:///" + packagePath, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
210 |
"-package", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24217
diff
changeset
|
211 |
"pkg2" |
23974
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
212 |
}; |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
213 |
System.out.println("packagePath: " + packagePath); |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
214 |
return args; |
d53628eda3d1
8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents:
23971
diff
changeset
|
215 |
} |
10 | 216 |
} |