|
1 /* |
|
2 * Copyright (c) 2017, 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. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 /* |
|
27 * @test |
|
28 * @bug 8173425 |
|
29 * @summary extend com.sun.source API to support parsing javadoc comments |
|
30 * @modules jdk.compiler/com.sun.tools.javac.api |
|
31 * jdk.compiler/com.sun.tools.javac.file |
|
32 * jdk.compiler/com.sun.tools.javac.tree |
|
33 * jdk.compiler/com.sun.tools.javac.util |
|
34 * @build DocCommentTester |
|
35 * @run main DocCommentTester SummaryTest.java |
|
36 */ |
|
37 |
|
38 class SummaryTest { |
|
39 /** |
|
40 * {@summary} abc. |
|
41 */ |
|
42 void empty() { } |
|
43 /* |
|
44 DocComment[DOC_COMMENT, pos:1 |
|
45 firstSentence: 1 |
|
46 Summary[SUMMARY, pos:1 |
|
47 summary: empty |
|
48 ] |
|
49 body: 1 |
|
50 Text[TEXT, pos:11, _abc.] |
|
51 block tags: empty |
|
52 ] |
|
53 */ |
|
54 /** |
|
55 * {@summary abc} def. |
|
56 */ |
|
57 void simple() { } |
|
58 /* |
|
59 DocComment[DOC_COMMENT, pos:1 |
|
60 firstSentence: 1 |
|
61 Summary[SUMMARY, pos:1 |
|
62 summary: 1 |
|
63 Text[TEXT, pos:11, abc] |
|
64 ] |
|
65 body: 1 |
|
66 Text[TEXT, pos:15, _def.] |
|
67 block tags: empty |
|
68 ] |
|
69 */ |
|
70 |
|
71 /** |
|
72 * {@summary abc} def |
|
73 */ |
|
74 void leading_space() { } |
|
75 /* |
|
76 DocComment[DOC_COMMENT, pos:4 |
|
77 firstSentence: 1 |
|
78 Summary[SUMMARY, pos:4 |
|
79 summary: 1 |
|
80 Text[TEXT, pos:14, abc] |
|
81 ] |
|
82 body: 1 |
|
83 Text[TEXT, pos:18, _def] |
|
84 block tags: empty |
|
85 ] |
|
86 */ |
|
87 |
|
88 /** |
|
89 * <p> {@summary abc} def |
|
90 */ |
|
91 void leading_html() { } |
|
92 /* |
|
93 DocComment[DOC_COMMENT, pos:1 |
|
94 firstSentence: 3 |
|
95 StartElement[START_ELEMENT, pos:1 |
|
96 name:p |
|
97 attributes: empty |
|
98 ] |
|
99 Text[TEXT, pos:4, _] |
|
100 Summary[SUMMARY, pos:5 |
|
101 summary: 1 |
|
102 Text[TEXT, pos:15, abc] |
|
103 ] |
|
104 body: 1 |
|
105 Text[TEXT, pos:19, _def] |
|
106 block tags: empty |
|
107 ] |
|
108 */ |
|
109 |
|
110 /** |
|
111 * abc {@summary def} ghi |
|
112 */ |
|
113 void leading_text() { } |
|
114 /* |
|
115 DocComment[DOC_COMMENT, pos:1 |
|
116 firstSentence: 2 |
|
117 Text[TEXT, pos:1, abc_] |
|
118 Summary[SUMMARY, pos:5 |
|
119 summary: 1 |
|
120 Text[TEXT, pos:15, def] |
|
121 ] |
|
122 body: 1 |
|
123 Text[TEXT, pos:19, _ghi] |
|
124 block tags: empty |
|
125 ] |
|
126 */ |
|
127 |
|
128 /** |
|
129 * abc. {@summary def} ghi |
|
130 */ |
|
131 void leading_text_with_break() { } |
|
132 /* |
|
133 DocComment[DOC_COMMENT, pos:1 |
|
134 firstSentence: 1 |
|
135 Text[TEXT, pos:1, abc.] |
|
136 body: 2 |
|
137 Summary[SUMMARY, pos:6 |
|
138 summary: 1 |
|
139 Text[TEXT, pos:16, def] |
|
140 ] |
|
141 Text[TEXT, pos:20, _ghi] |
|
142 block tags: empty |
|
143 ] |
|
144 */ |
|
145 |
|
146 /** |
|
147 * {@summary def} <p> ghi |
|
148 */ |
|
149 void trailing_html() { } |
|
150 /* |
|
151 DocComment[DOC_COMMENT, pos:1 |
|
152 firstSentence: 1 |
|
153 Summary[SUMMARY, pos:1 |
|
154 summary: 1 |
|
155 Text[TEXT, pos:11, def] |
|
156 ] |
|
157 body: 3 |
|
158 Text[TEXT, pos:15, _] |
|
159 StartElement[START_ELEMENT, pos:16 |
|
160 name:p |
|
161 attributes: empty |
|
162 ] |
|
163 Text[TEXT, pos:19, _ghi] |
|
164 block tags: empty |
|
165 ] |
|
166 */ |
|
167 |
|
168 /** |
|
169 * {@summary abc <def> ghi} jkl |
|
170 */ |
|
171 void with_html() { } |
|
172 /* |
|
173 DocComment[DOC_COMMENT, pos:1 |
|
174 firstSentence: 1 |
|
175 Summary[SUMMARY, pos:1 |
|
176 summary: 5 |
|
177 Text[TEXT, pos:11, abc_] |
|
178 Entity[ENTITY, pos:15, lt] |
|
179 Text[TEXT, pos:19, def] |
|
180 Entity[ENTITY, pos:22, gt] |
|
181 Text[TEXT, pos:26, _ghi] |
|
182 ] |
|
183 body: 1 |
|
184 Text[TEXT, pos:31, _jkl] |
|
185 block tags: empty |
|
186 ] |
|
187 */ |
|
188 } |