Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java
40974 views
1
/*
2
* Copyright (c) 2019, 2021, 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 8215584
27
* @summary Remove support for the "old" doclet API in com/sun/javadoc
28
* @library /tools/lib ../../lib
29
* @modules jdk.javadoc/jdk.javadoc.internal.tool
30
* @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder
31
* @run main RemoveOldDoclet
32
*/
33
34
35
import java.nio.file.Path;
36
import java.nio.file.Paths;
37
38
import builder.ClassBuilder;
39
import toolbox.ToolBox;
40
41
import javadoc.tester.JavadocTester;
42
43
public class RemoveOldDoclet extends JavadocTester {
44
45
final ToolBox tb;
46
static final String Doclet_CLASS_NAME = TestDoclet.class.getName();
47
48
public static void main(String... args) throws Exception {
49
RemoveOldDoclet tester = new RemoveOldDoclet();
50
tester.runTests(m -> new Object[]{Paths.get(m.getName())});
51
}
52
53
RemoveOldDoclet() {
54
tb = new ToolBox();
55
}
56
57
@Test
58
public void testInvalidDoclet(Path base) throws Exception {
59
Path srcDir = base.resolve("src");
60
Path outDir = base.resolve("out");
61
62
new ClassBuilder(tb, "pkg.A")
63
.setModifiers("public", "class")
64
.write(srcDir);
65
66
javadoc("-d", outDir.toString(),
67
"-doclet", Doclet_CLASS_NAME,
68
"-docletpath", System.getProperty("test.classes", "."),
69
"-sourcepath", srcDir.toString(),
70
"pkg");
71
72
checkExit(Exit.ERROR);
73
checkOutput(Output.OUT, true, String.format("""
74
error: Class %s is not a valid doclet.
75
Note: As of JDK 13, the com.sun.javadoc API is no longer supported.""",
76
Doclet_CLASS_NAME));
77
}
78
79
static class TestDoclet {
80
public static boolean start() {
81
System.out.println("OLD_DOCLET_MARKER");
82
return true;
83
}
84
}
85
}
86
87