2
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.
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
26
* @bug 8078320 8273244 8284908
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 InPreTest.java
38
* xyz<pre> pqr </pre> abc{@code def }ghi
40
public void after_pre() { }
42
DocComment[DOC_COMMENT, pos:1
44
Text[TEXT, pos:1, xyz]
46
StartElement[START_ELEMENT, pos:4
50
Text[TEXT, pos:9, _pqr_]
51
EndElement[END_ELEMENT, pos:14, pre]
52
Text[TEXT, pos:20, _abc]
53
Literal[CODE, pos:24, _def__]
54
Text[TEXT, pos:38, ghi]
61
public void no_pre() { }
63
DocComment[DOC_COMMENT, pos:1
65
Text[TEXT, pos:1, abc]
66
Literal[CODE, pos:4, def]
67
Text[TEXT, pos:15, ghi]
73
* xyz<pre> abc{@code def }ghi</pre>
75
public void pre_after_text() {}
77
DocComment[DOC_COMMENT, pos:1
79
Text[TEXT, pos:1, xyz]
81
StartElement[START_ELEMENT, pos:4
85
Text[TEXT, pos:9, _abc]
86
Literal[CODE, pos:13, _def__]
87
Text[TEXT, pos:27, ghi]
88
EndElement[END_ELEMENT, pos:30, pre]
96
public void no_pre_extra_whitespace() { }
98
DocComment[DOC_COMMENT, pos:1
100
Text[TEXT, pos:1, abc]
101
Literal[CODE, pos:4, _def__]
102
Text[TEXT, pos:18, ghi]
108
* <pre> abc{@code def }ghi</pre>
110
public void in_pre() { }
112
DocComment[DOC_COMMENT, pos:1
114
StartElement[START_ELEMENT, pos:1
118
Text[TEXT, pos:6, _abc]
119
Literal[CODE, pos:10, _def__]
120
Text[TEXT, pos:24, ghi]
122
EndElement[END_ELEMENT, pos:27, pre]
130
public void in_pre_with_space_nl() { }
132
DocComment[DOC_COMMENT, pos:1
134
StartElement[START_ELEMENT, pos:1
138
Text[TEXT, pos:6, _abc]
139
Literal[CODE, pos:10, |_def__]
140
Text[TEXT, pos:24, ghi]
142
EndElement[END_ELEMENT, pos:27, pre]
151
public void in_pre_with_nl() { }
153
DocComment[DOC_COMMENT, pos:1
155
StartElement[START_ELEMENT, pos:1
159
Text[TEXT, pos:6, _abc]
160
Literal[CODE, pos:10, |def__]
161
Text[TEXT, pos:23, ghi]
163
EndElement[END_ELEMENT, pos:26, pre]
170
public void bad_code_no_content() { }
172
DocComment[DOC_COMMENT, pos:1
174
Text[TEXT, pos:1, abc_]
175
Erroneous[ERRONEOUS, pos:5, prefPos:10
176
code: compiler.err.dc.unterminated.inline.tag
186
public void bad_code_content() { }
188
DocComment[DOC_COMMENT, pos:1
190
Text[TEXT, pos:1, abc_]
191
Erroneous[ERRONEOUS, pos:5, prefPos:14
192
code: compiler.err.dc.unterminated.inline.tag