Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/tool/NoStar.java
40957 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 4587562
27
* @summary tool: Indentation messed up for javadoc comments omitting preceding *
28
* @modules jdk.javadoc/jdk.javadoc.internal.tool
29
* @run main NoStar
30
*/
31
32
import java.util.*;
33
34
import javax.lang.model.SourceVersion;
35
import javax.lang.model.element.TypeElement;
36
import javax.lang.model.util.ElementFilter;
37
38
import com.sun.source.doctree.DocCommentTree;
39
import com.sun.source.util.DocTrees;
40
import jdk.javadoc.doclet.Doclet;
41
import jdk.javadoc.doclet.Reporter;
42
import jdk.javadoc.doclet.DocletEnvironment;
43
44
/** First sentence.
45
0
46
1
47
2
48
3
49
4
50
5
51
*/
52
public class NoStar implements Doclet
53
{
54
public static void main(String[] args) {
55
String[] argarray = {
56
"-docletpath", System.getProperty("test.classes", "."),
57
"-doclet", "NoStar",
58
System.getProperty("test.src", ".") + java.io.File.separatorChar + "NoStar.java"
59
};
60
if (jdk.javadoc.internal.tool.Main.execute(argarray) != 0)
61
throw new Error();
62
}
63
64
public boolean run(DocletEnvironment root) {
65
Set<TypeElement> classes = ElementFilter.typesIn(root.getIncludedElements());
66
if (classes.size() != 1)
67
throw new Error("1 " + Arrays.asList(classes));
68
TypeElement self = classes.iterator().next();
69
DocTrees trees = root.getDocTrees();
70
DocCommentTree docCommentTree = trees.getDocCommentTree(self);
71
String c = docCommentTree.getFullBody().toString();
72
System.out.println("\"" + c + "\"");
73
return c.equals("""
74
First sentence.
75
0
76
1
77
2
78
3
79
4
80
5""");
81
}
82
83
@Override
84
public String getName() {
85
return "Test";
86
}
87
88
@Override
89
public Set<Option> getSupportedOptions() {
90
return Collections.emptySet();
91
}
92
93
@Override
94
public SourceVersion getSupportedSourceVersion() {
95
return SourceVersion.latest();
96
}
97
98
@Override
99
public void init(Locale locale, Reporter reporter) {
100
return;
101
}
102
}
103
104