|
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 CodeTest.java |
|
30 */ |
|
31 |
|
32 class CodeTest { |
|
33 /** {@code if (a < b) { }} */ |
|
34 void minimal() { } |
|
35 /* |
|
36 DocComment[DOC_COMMENT, pos:0 |
|
37 firstSentence: 1 |
|
38 Literal[CODE, pos:0, if_(a_<_b)_{_}] |
|
39 body: empty |
|
40 block tags: empty |
|
41 ] |
|
42 */ |
|
43 |
|
44 /** [{@code if (a < b) { }}] */ |
|
45 void in_brackets() { } |
|
46 /* |
|
47 DocComment[DOC_COMMENT, pos:0 |
|
48 firstSentence: 3 |
|
49 Text[TEXT, pos:0, [] |
|
50 Literal[CODE, pos:1, if_(a_<_b)_{_}] |
|
51 Text[TEXT, pos:23, ]] |
|
52 body: empty |
|
53 block tags: empty |
|
54 ] |
|
55 */ |
|
56 |
|
57 /** [ {@code if (a < b) { }} ] */ |
|
58 void in_brackets_with_whitespace() { } |
|
59 /* |
|
60 DocComment[DOC_COMMENT, pos:0 |
|
61 firstSentence: 3 |
|
62 Text[TEXT, pos:0, [_] |
|
63 Literal[CODE, pos:2, if_(a_<_b)_{_}] |
|
64 Text[TEXT, pos:24, _]] |
|
65 body: empty |
|
66 block tags: empty |
|
67 ] |
|
68 */ |
|
69 |
|
70 /** |
|
71 * {@code {@code nested} } |
|
72 */ |
|
73 void nested() { } |
|
74 /* |
|
75 DocComment[DOC_COMMENT, pos:1 |
|
76 firstSentence: 1 |
|
77 Literal[CODE, pos:1, {@code_nested}_] |
|
78 body: empty |
|
79 block tags: empty |
|
80 ] |
|
81 */ |
|
82 |
|
83 /** |
|
84 * {@code if (a < b) { |
|
85 * } |
|
86 * } |
|
87 */ |
|
88 void embedded_newline() { } |
|
89 /* |
|
90 DocComment[DOC_COMMENT, pos:1 |
|
91 firstSentence: 1 |
|
92 Literal[CODE, pos:1, if_(a_<_b)_{|________}|_] |
|
93 body: empty |
|
94 block tags: empty |
|
95 ] |
|
96 */ |
|
97 |
|
98 /** {@code if (a < b) { } */ |
|
99 void unterminated_1() { } |
|
100 /* |
|
101 DocComment[DOC_COMMENT, pos:0 |
|
102 firstSentence: 1 |
|
103 Erroneous[ERRONEOUS, pos:0 |
|
104 code: compiler.err.dc.unterminated.inline.tag |
|
105 body: {@code_if_(a_<_b)_{_} |
|
106 ] |
|
107 body: empty |
|
108 block tags: empty |
|
109 ] |
|
110 */ |
|
111 |
|
112 /** |
|
113 * {@code if (a < b) { } |
|
114 * @author jjg */ |
|
115 void unterminated_2() { } |
|
116 /* |
|
117 DocComment[DOC_COMMENT, pos:1 |
|
118 firstSentence: 1 |
|
119 Erroneous[ERRONEOUS, pos:1 |
|
120 code: compiler.err.dc.unterminated.inline.tag |
|
121 body: {@code_if_(a_<_b)_{_} |
|
122 ] |
|
123 body: empty |
|
124 block tags: 1 |
|
125 Author[AUTHOR, pos:24 |
|
126 name: 1 |
|
127 Text[TEXT, pos:32, jjg] |
|
128 ] |
|
129 ] |
|
130 */ |
|
131 |
|
132 } |
|
133 |