|
1 /* |
|
2 * Copyright (c) 2012, 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 |
|
27 * @summary extend com.sun.source API to support parsing javadoc comments |
|
28 * @build DocCommentTester |
|
29 * @run main DocCommentTester FirstSentenceTest.java |
|
30 */ |
|
31 |
|
32 class FirstSentenceTest { |
|
33 /** */ |
|
34 void empty() { } |
|
35 /* |
|
36 DocComment[DOC_COMMENT, pos:-1 |
|
37 firstSentence: empty |
|
38 body: empty |
|
39 block tags: empty |
|
40 ] |
|
41 */ |
|
42 |
|
43 /** abc def ghi */ |
|
44 void no_terminator() { } |
|
45 /* |
|
46 DocComment[DOC_COMMENT, pos:0 |
|
47 firstSentence: 1 |
|
48 Text[TEXT, pos:0, abc_def_ghi] |
|
49 body: empty |
|
50 block tags: empty |
|
51 ] |
|
52 */ |
|
53 |
|
54 /** |
|
55 * abc def ghi. |
|
56 */ |
|
57 void no_body() { } |
|
58 /* |
|
59 DocComment[DOC_COMMENT, pos:1 |
|
60 firstSentence: 1 |
|
61 Text[TEXT, pos:1, abc_def_ghi.] |
|
62 body: empty |
|
63 block tags: empty |
|
64 ] |
|
65 */ |
|
66 |
|
67 /** |
|
68 * abc def ghi. jkl mno pqr. |
|
69 */ |
|
70 void dot_space() { } |
|
71 /* |
|
72 DocComment[DOC_COMMENT, pos:1 |
|
73 firstSentence: 1 |
|
74 Text[TEXT, pos:1, abc_def_ghi.] |
|
75 body: 1 |
|
76 Text[TEXT, pos:14, jkl_mno_pqr.] |
|
77 block tags: empty |
|
78 ] |
|
79 */ |
|
80 |
|
81 /** |
|
82 * abc def ghi. |
|
83 * jkl mno pqr |
|
84 */ |
|
85 void dot_newline() { } |
|
86 /* |
|
87 DocComment[DOC_COMMENT, pos:1 |
|
88 firstSentence: 1 |
|
89 Text[TEXT, pos:1, abc_def_ghi.] |
|
90 body: 1 |
|
91 Text[TEXT, pos:15, jkl_mno_pqr] |
|
92 block tags: empty |
|
93 ] |
|
94 */ |
|
95 |
|
96 /** |
|
97 * abc def ghi |
|
98 * <p>jkl mno pqr |
|
99 */ |
|
100 void dot_p() { } |
|
101 /* |
|
102 DocComment[DOC_COMMENT, pos:1 |
|
103 firstSentence: 1 |
|
104 Text[TEXT, pos:1, abc_def_ghi] |
|
105 body: 2 |
|
106 StartElement[START_ELEMENT, pos:14 |
|
107 name:p |
|
108 attributes: empty |
|
109 ] |
|
110 Text[TEXT, pos:17, jkl_mno_pqr] |
|
111 block tags: empty |
|
112 ] |
|
113 */ |
|
114 |
|
115 /** |
|
116 * abc def ghi |
|
117 * </p>jkl mno pqr |
|
118 */ |
|
119 void dot_end_p() { } |
|
120 /* |
|
121 DocComment[DOC_COMMENT, pos:1 |
|
122 firstSentence: 1 |
|
123 Text[TEXT, pos:1, abc_def_ghi] |
|
124 body: 2 |
|
125 EndElement[END_ELEMENT, pos:14, p] |
|
126 Text[TEXT, pos:18, jkl_mno_pqr] |
|
127 block tags: empty |
|
128 ] |
|
129 */ |
|
130 |
|
131 /** |
|
132 * abc < ghi. jkl mno pqr. |
|
133 */ |
|
134 void entity() { } |
|
135 /* |
|
136 DocComment[DOC_COMMENT, pos:1 |
|
137 firstSentence: 3 |
|
138 Text[TEXT, pos:1, abc_] |
|
139 Entity[ENTITY, pos:5, lt] |
|
140 Text[TEXT, pos:9, _ghi.] |
|
141 body: 1 |
|
142 Text[TEXT, pos:15, jkl_mno_pqr.] |
|
143 block tags: empty |
|
144 ] |
|
145 */ |
|
146 |
|
147 /** |
|
148 * abc {@code code} ghi. jkl mno pqr. |
|
149 */ |
|
150 void inline_tag() { } |
|
151 /* |
|
152 DocComment[DOC_COMMENT, pos:1 |
|
153 firstSentence: 3 |
|
154 Text[TEXT, pos:1, abc_] |
|
155 Literal[CODE, pos:5, code] |
|
156 Text[TEXT, pos:17, _ghi.] |
|
157 body: 1 |
|
158 Text[TEXT, pos:23, jkl_mno_pqr.] |
|
159 block tags: empty |
|
160 ] |
|
161 */ |
|
162 |
|
163 /** |
|
164 * abc def ghi |
|
165 * @author jjg |
|
166 */ |
|
167 void block_tag() { } |
|
168 /* |
|
169 DocComment[DOC_COMMENT, pos:1 |
|
170 firstSentence: 1 |
|
171 Text[TEXT, pos:1, abc_def_ghi] |
|
172 body: empty |
|
173 block tags: 1 |
|
174 Author[AUTHOR, pos:14 |
|
175 name: 1 |
|
176 Text[TEXT, pos:22, jjg] |
|
177 ] |
|
178 ] |
|
179 */ |
|
180 |
|
181 /** |
|
182 * @author jjg |
|
183 */ |
|
184 void just_tag() { } |
|
185 /* |
|
186 DocComment[DOC_COMMENT, pos:1 |
|
187 firstSentence: empty |
|
188 body: empty |
|
189 block tags: 1 |
|
190 Author[AUTHOR, pos:1 |
|
191 name: 1 |
|
192 Text[TEXT, pos:9, jjg] |
|
193 ] |
|
194 ] |
|
195 */ |
|
196 |
|
197 } |
|
198 |