1/*
2 * Copyright (c) 2012, 2015, 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 8078320
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 ElementTest.java
34 */
35
36class ElementTest {
37    /**
38     * <p>para</p>
39     */
40    void simple() { }
41/*
42DocComment[DOC_COMMENT, pos:1
43  firstSentence: 2
44    StartElement[START_ELEMENT, pos:1
45      name:p
46      attributes: empty
47    ]
48    Text[TEXT, pos:4, para]
49  body: 1
50    EndElement[END_ELEMENT, pos:8, p]
51  block tags: empty
52]
53*/
54
55    /**
56     * abc <hr/>
57     */
58    void self_closing() { }
59/*
60DocComment[DOC_COMMENT, pos:1
61  firstSentence: 2
62    Text[TEXT, pos:1, abc_]
63    StartElement[START_ELEMENT, pos:5
64      name:hr
65      attributes: empty
66    ]
67  body: empty
68  block tags: empty
69]
70*/
71
72    /**
73     * abc < def
74     */
75    void bad_lt() { }
76/*
77DocComment[DOC_COMMENT, pos:1
78  firstSentence: 3
79    Text[TEXT, pos:1, abc_]
80    Erroneous[ERRONEOUS, pos:5
81      code: compiler.err.dc.malformed.html
82      body: <
83    ]
84    Text[TEXT, pos:6, _def]
85  body: empty
86  block tags: empty
87]
88*/
89
90    /**
91     * abc > def
92     */
93    void bad_gt() { }
94/*
95DocComment[DOC_COMMENT, pos:1
96  firstSentence: 3
97    Text[TEXT, pos:1, abc_]
98    Erroneous[ERRONEOUS, pos:5
99      code: compiler.err.dc.bad.gt
100      body: >
101    ]
102    Text[TEXT, pos:6, _def]
103  body: empty
104  block tags: empty
105]
106*/
107
108    /**
109     * abc <p 123> def
110     */
111    void bad_chars_start();
112/*
113DocComment[DOC_COMMENT, pos:1
114  firstSentence: 5
115    Text[TEXT, pos:1, abc_]
116    Erroneous[ERRONEOUS, pos:5
117      code: compiler.err.dc.malformed.html
118      body: <
119    ]
120    Text[TEXT, pos:6, p_123]
121    Erroneous[ERRONEOUS, pos:11
122      code: compiler.err.dc.bad.gt
123      body: >
124    ]
125    Text[TEXT, pos:12, _def]
126  body: empty
127  block tags: empty
128]
129*/
130
131    /**
132     * abc </p 123> def
133     */
134    void bad_chars_end();
135/*
136DocComment[DOC_COMMENT, pos:1
137  firstSentence: 5
138    Text[TEXT, pos:1, abc_]
139    Erroneous[ERRONEOUS, pos:5
140      code: compiler.err.dc.malformed.html
141      body: <
142    ]
143    Text[TEXT, pos:6, /p_123]
144    Erroneous[ERRONEOUS, pos:12
145      code: compiler.err.dc.bad.gt
146      body: >
147    ]
148    Text[TEXT, pos:13, _def]
149  body: empty
150  block tags: empty
151]
152*/
153
154    /**
155     * abc <hr
156     */
157    void unterminated_eoi() { }
158/*
159DocComment[DOC_COMMENT, pos:1
160  firstSentence: 3
161    Text[TEXT, pos:1, abc_]
162    Erroneous[ERRONEOUS, pos:5
163      code: compiler.err.dc.malformed.html
164      body: <
165    ]
166    Text[TEXT, pos:6, hr]
167  body: empty
168  block tags: empty
169]
170*/
171
172    /**
173     * abc <hr
174     * @author jjg
175     */
176    void unterminated_block() { }
177/*
178DocComment[DOC_COMMENT, pos:1
179  firstSentence: 3
180    Text[TEXT, pos:1, abc_]
181    Erroneous[ERRONEOUS, pos:5
182      code: compiler.err.dc.malformed.html
183      body: <
184    ]
185    Text[TEXT, pos:6, hr]
186  body: empty
187  block tags: 1
188    Author[AUTHOR, pos:10
189      name: 1
190        Text[TEXT, pos:18, jjg]
191    ]
192]
193*/
194
195
196    /**
197     * abc </p
198     */
199    void unterminated_end_eoi() { }
200/*
201DocComment[DOC_COMMENT, pos:1
202  firstSentence: 3
203    Text[TEXT, pos:1, abc_]
204    Erroneous[ERRONEOUS, pos:5
205      code: compiler.err.dc.malformed.html
206      body: <
207    ]
208    Text[TEXT, pos:6, /p]
209  body: empty
210  block tags: empty
211]
212*/
213
214    /**
215     * abc </p
216     * @author jjg
217     */
218    void unterminated_end_block() { }
219/*
220DocComment[DOC_COMMENT, pos:1
221  firstSentence: 3
222    Text[TEXT, pos:1, abc_]
223    Erroneous[ERRONEOUS, pos:5
224      code: compiler.err.dc.malformed.html
225      body: <
226    ]
227    Text[TEXT, pos:6, /p]
228  body: empty
229  block tags: 1
230    Author[AUTHOR, pos:10
231      name: 1
232        Text[TEXT, pos:18, jjg]
233    ]
234]
235*/
236
237    /**
238     * abc
239     * <!-- comment -->
240     * def
241     */
242    void comment() { }
243/*
244DocComment[DOC_COMMENT, pos:1
245  firstSentence: 3
246    Text[TEXT, pos:1, abc|_]
247    Comment[COMMENT, pos:6, <!--_comment_-->]
248    Text[TEXT, pos:22, |_def]
249  body: empty
250  block tags: empty
251]
252*/
253
254}
255