jdk
1/*
2* Copyright (c) 2012, 2023, 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 7021614 8031212 8273244 8284908 8200337 8288619
27* @summary extend com.sun.source API to support parsing javadoc comments
28* @modules jdk.compiler/com.sun.tools.javac.api
29* jdk.compiler/com.sun.tools.javac.file
30* jdk.compiler/com.sun.tools.javac.tree
31* jdk.compiler/com.sun.tools.javac.util
32* @build DocCommentTester
33* @run main DocCommentTester SeeTest.java
34*/
35
36class SeeTest {37/**38* abc.
39* @see "String"
40*/
41void quoted_text() { }42/*
43DocComment[DOC_COMMENT, pos:1
44firstSentence: 1
45Text[TEXT, pos:1, abc.]
46body: empty
47block tags: 1
48See[SEE, pos:7
49reference: 1
50Text[TEXT, pos:12, "String"]
51]
52]
53*/
54
55/**56* Test '@' in quoted string.
57* @see "{@code}"
58*/
59void at_sign_in_quoted_string() { }60/*
61DocComment[DOC_COMMENT, pos:1
62firstSentence: 1
63Text[TEXT, pos:1, Test_'@'_in_quoted_string.]
64body: empty
65block tags: 1
66See[SEE, pos:29
67reference: 1
68Text[TEXT, pos:34, "{@code}"]
69]
70]
71*/
72
73/**74* Test new line before quoted string.
75* @see
76* "{@code}"
77*/
78@PrettyCheck(false)79void new_line_before_quoted_string() { }80/*
81DocComment[DOC_COMMENT, pos:1
82firstSentence: 1
83Text[TEXT, pos:1, Test_new_line_before_quoted_string.]
84body: empty
85block tags: 1
86See[SEE, pos:38
87reference: 1
88Text[TEXT, pos:47, "{@code}"]
89]
90]
91*/
92
93/**94* abc.
95* @see <a href="url">url</a>
96*/
97void url() { }98/*
99DocComment[DOC_COMMENT, pos:1
100firstSentence: 1
101Text[TEXT, pos:1, abc.]
102body: empty
103block tags: 1
104See[SEE, pos:7
105reference: 3
106StartElement[START_ELEMENT, pos:12
107name:a
108attributes: 1
109Attribute[ATTRIBUTE, pos:15
110name: href
111vkind: DOUBLE
112value: 1
113Text[TEXT, pos:21, url]
114]
115]
116Text[TEXT, pos:26, url]
117EndElement[END_ELEMENT, pos:29, a]
118]
119]
120*/
121
122/**123* abc.
124* @see String text
125*/
126void string() { }127/*
128DocComment[DOC_COMMENT, pos:1
129firstSentence: 1
130Text[TEXT, pos:1, abc.]
131body: empty
132block tags: 1
133See[SEE, pos:7
134reference: 2
135Reference[REFERENCE, pos:12, String]
136Text[TEXT, pos:19, text]
137]
138]
139*/
140
141/**142* abc.
143* @see java.lang.String text
144*/
145void j_l_string() { }146/*
147DocComment[DOC_COMMENT, pos:1
148firstSentence: 1
149Text[TEXT, pos:1, abc.]
150body: empty
151block tags: 1
152See[SEE, pos:7
153reference: 2
154Reference[REFERENCE, pos:12, java.lang.String]
155Text[TEXT, pos:29, text]
156]
157]
158*/
159
160/**161* abc.
162* @see java.lang.String#length text
163*/
164void j_l_string_length() { }165/*
166DocComment[DOC_COMMENT, pos:1
167firstSentence: 1
168Text[TEXT, pos:1, abc.]
169body: empty
170block tags: 1
171See[SEE, pos:7
172reference: 2
173Reference[REFERENCE, pos:12, java.lang.String#length]
174Text[TEXT, pos:36, text]
175]
176]
177*/
178
179/**180* abc.
181* @see java.lang.String#matches(String regex) text
182*/
183void j_l_string_matches() { }184/*
185DocComment[DOC_COMMENT, pos:1
186firstSentence: 1
187Text[TEXT, pos:1, abc.]
188body: empty
189block tags: 1
190See[SEE, pos:7
191reference: 2
192Reference[REFERENCE, pos:12, java.lang.String#matches(String_regex)]
193Text[TEXT, pos:51, text]
194]
195]
196*/
197
198/**199* abc.
200* @see java.lang.String##fragment text
201*/
202void j_l_string_anchor() { }203/*
204DocComment[DOC_COMMENT, pos:1
205firstSentence: 1
206Text[TEXT, pos:1, abc.]
207body: empty
208block tags: 1
209See[SEE, pos:7
210reference: 2
211Reference[REFERENCE, pos:12, java.lang.String##fragment]
212Text[TEXT, pos:39, text]
213]
214]
215*/
216
217/**218* abc.
219* @see 123 text
220*/
221void bad_numeric() { }222/*
223DocComment[DOC_COMMENT, pos:1
224firstSentence: 1
225Text[TEXT, pos:1, abc.]
226body: empty
227block tags: 1
228Erroneous[ERRONEOUS, pos:7, prefPos:19
229code: compiler.err.dc.unexpected.content
230body: @see_123_text
231]
232]
233*/
234
235}
236