Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/doclet/testDiagsLineCaret/TestDiagsLineCaret.java
40971 views
1
/*
2
* Copyright (c) 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 8267126 8267176
27
* @summary javadoc should show "line and caret" for diagnostics
28
* @library /tools/lib ../../lib
29
* @modules jdk.javadoc/jdk.javadoc.internal.tool
30
* @build javadoc.tester.* MyTaglet
31
* @run main TestDiagsLineCaret
32
*/
33
34
import java.io.IOException;
35
import java.nio.file.Path;
36
37
import javadoc.tester.JavadocTester;
38
import toolbox.ToolBox;
39
40
public class TestDiagsLineCaret extends JavadocTester {
41
42
public static void main(String... args) throws Exception {
43
TestDiagsLineCaret tester = new TestDiagsLineCaret();
44
tester.runTests();
45
}
46
47
ToolBox tb = new ToolBox();
48
49
@Test
50
public void testDiags() throws IOException {
51
tb.writeJavaFiles(Path.of("."), """
52
/**
53
* First sentence.
54
* @since def 🥕 ghi
55
*/
56
public class MyClass { }
57
""");
58
59
String testClasses = System.getProperty("test.classes");
60
61
javadoc("-d", "out",
62
"-XDaccessInternalAPI",
63
"-tagletpath", testClasses,
64
"-taglet", "MyTaglet",
65
"MyClass.java");
66
checkExit(Exit.ERROR);
67
68
checkOutput(Output.OUT, true,
69
"""
70
error: This is a error
71
warning: This is a warning
72
warning: This is a mandatory_warning
73
Note: This is a note
74
MyClass.java:5: error: This is a error for MyClass
75
public class MyClass { }
76
^
77
MyClass.java:5: warning: This is a warning for MyClass
78
public class MyClass { }
79
^
80
MyClass.java:5: warning: This is a mandatory_warning for MyClass
81
public class MyClass { }
82
^
83
MyClass.java:5: Note: This is a note for MyClass
84
public class MyClass { }
85
^
86
MyClass.java:3: error: This is a error: this is not a caret
87
* @since def 🥕 ghi
88
^
89
MyClass.java:3: warning: This is a warning: this is not a caret
90
* @since def 🥕 ghi
91
^
92
MyClass.java:3: warning: This is a mandatory_warning: this is not a caret
93
* @since def 🥕 ghi
94
^
95
MyClass.java:3: Note: This is a note: this is not a caret
96
* @since def 🥕 ghi
97
^
98
""",
99
"""
100
3 errors
101
6 warnings
102
""");
103
}
104
}
105
106