Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/tool/completionFailure/CompletionFailure.java
40971 views
1
/*
2
* Copyright (c) 2002, 2019, 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 4670772 6328529
27
* @summary Completion failures should be ignored in javadoc.
28
* @modules jdk.javadoc/jdk.javadoc.internal.tool
29
*/
30
31
32
import java.io.PrintWriter;
33
import java.util.*;
34
35
import javax.lang.model.SourceVersion;
36
import javax.lang.model.element.TypeElement;
37
import javax.lang.model.util.ElementFilter;
38
39
import jdk.javadoc.doclet.Doclet;
40
import jdk.javadoc.doclet.DocletEnvironment;
41
import jdk.javadoc.doclet.Reporter;
42
43
public class CompletionFailure implements Doclet {
44
public static void main(String[] args) {
45
String[] toolargs = {
46
"-doclet", "CompletionFailure",
47
"-docletpath", System.getProperty("test.classes", "."),
48
"pkg"
49
};
50
// run javadoc on package pkg
51
if (jdk.javadoc.internal.tool.Main.execute(toolargs,
52
new PrintWriter(System.err)) != 0)
53
throw new Error();
54
}
55
56
public boolean run(DocletEnvironment root) {
57
Set<TypeElement> classes = ElementFilter.typesIn(root.getIncludedElements());
58
if (classes.size() != 1)
59
throw new Error("1 " + Arrays.asList(classes));
60
return true;
61
}
62
63
@Override
64
public String getName() {
65
return "Test";
66
}
67
68
@Override
69
public Set<Option> getSupportedOptions() {
70
return Collections.emptySet();
71
}
72
73
@Override
74
public SourceVersion getSupportedSourceVersion() {
75
return SourceVersion.latest();
76
}
77
78
@Override
79
public void init(Locale locale, Reporter reporter) {
80
// do nothing
81
}
82
}
83
84