Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java
40971 views
1
/*
2
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
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
*
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.
22
*/
23
24
/*
25
* @test
26
* @bug 4652655 4857717 8025633 8026567 8071982 8164407 8182765 8205593 8240169
27
* @summary This test verifies that class cross references work properly.
28
* @library ../../lib
29
* @modules jdk.javadoc/jdk.javadoc.internal.tool
30
* @build javadoc.tester.*
31
* @build TestClassCrossReferences
32
* @run main TestClassCrossReferences
33
*/
34
35
import javadoc.tester.JavadocTester;
36
37
public class TestClassCrossReferences extends JavadocTester {
38
39
static final String uri = "http://docs.oracle.com/javase/8/docs/api/";
40
41
public static void main(String... args) throws Exception {
42
TestClassCrossReferences tester = new TestClassCrossReferences();
43
tester.runTests();
44
}
45
46
@Test
47
public void test() {
48
javadoc("-d", "out",
49
"-source", "8",
50
"-Xdoclint:none",
51
"-sourcepath", testSrc,
52
"-linkoffline", uri, testSrc,
53
"--no-platform-links",
54
testSrc("C.java"));
55
checkExit(Exit.OK);
56
57
checkOutput("C.html", true,
58
"<a href=\"" + uri + """
59
java/math/package-summary.html" class="external-link"><code>Link to math package</code></a>""",
60
"<a href=\"" + uri + """
61
javax/swing/text/AbstractDocument.AttributeContext.html" title="class or interfa\
62
ce in javax.swing.text" class="external-link"><code>Link to AttributeContext inn\
63
erclass</code></a>""",
64
"<a href=\"" + uri + """
65
java/math/BigDecimal.html" title="class or interface in java.math" class="extern\
66
al-link"><code>Link to external class BigDecimal</code></a>""",
67
"<a href=\"" + uri + """
68
java/math/BigInteger.html#gcd(java.math.BigInteger)" title="class or interface i\
69
n java.math" class="external-link"><code>Link to external member gcd</code></a>""",
70
"<a href=\"" + uri + """
71
javax/tools/SimpleJavaFileObject.html#uri" title="class or interface in javax.to\
72
ols" class="external-link"><code>Link to external member URI</code></a>""",
73
"""
74
<dl class="notes">
75
<dt>Overrides:</dt>
76
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
77
</dl>""");
78
}
79
80
@Test
81
public void test_warning() {
82
javadoc("-d", "out-warning",
83
"-Xdoclint:none",
84
"-sourcepath", testSrc,
85
"-linkoffline", uri, testSrc,
86
"--no-platform-links",
87
testSrc("C.java"));
88
checkExit(Exit.OK);
89
90
checkOutput(Output.OUT, true,
91
"The code being documented uses modules but the packages defined"
92
+ " in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module");
93
94
checkOutput("C.html", true,
95
"<a href=\"" + uri + """
96
java/math/package-summary.html" class="external-link"><code>Link to math package</code></a>""",
97
"<a href=\"" + uri + """
98
javax/swing/text/AbstractDocument.AttributeContext.html" title="class or interfa\
99
ce in javax.swing.text" class="external-link"><code>Link to AttributeContext inn\
100
erclass</code></a>""",
101
"<a href=\"" + uri + """
102
java/math/BigDecimal.html" title="class or interface in java.math" class="extern\
103
al-link"><code>Link to external class BigDecimal</code></a>""",
104
"<a href=\"" + uri + """
105
java/math/BigInteger.html#gcd(java.math.BigInteger)" title="class or interface i\
106
n java.math" class="external-link"><code>Link to external member gcd</code></a>""",
107
"<a href=\"" + uri + """
108
javax/tools/SimpleJavaFileObject.html#uri" title="class or interface in javax.to\
109
ols" class="external-link"><code>Link to external member URI</code></a>""",
110
"""
111
<dl class="notes">
112
<dt>Overrides:</dt>
113
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
114
</dl>""");
115
}
116
}
117
118