InPreTest.java revision 3060:23f76aadbb36
1/*
2 * Copyright (c) 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 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 InPreTest.java
34 */
35
36class InPreTest {
37    /**
38     * xyz<pre> pqr </pre> abc{@code  def  }ghi
39     */
40    public void after_pre() { }
41/*
42DocComment[DOC_COMMENT, pos:1
43  firstSentence: 1
44    Text[TEXT, pos:1, xyz]
45  body: 6
46    StartElement[START_ELEMENT, pos:4
47      name:pre
48      attributes: empty
49    ]
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]
55  block tags: empty
56]
57*/
58    /**
59     * abc{@code def}ghi
60     */
61    public void no_pre() { }
62/*
63DocComment[DOC_COMMENT, pos:1
64  firstSentence: 3
65    Text[TEXT, pos:1, abc]
66    Literal[CODE, pos:4, def]
67    Text[TEXT, pos:15, ghi]
68  body: empty
69  block tags: empty
70]
71*/
72    /**
73     * xyz<pre> abc{@code  def  }ghi</pre>
74     */
75    public void pre_after_text() {}
76/*
77DocComment[DOC_COMMENT, pos:1
78  firstSentence: 1
79    Text[TEXT, pos:1, xyz]
80  body: 5
81    StartElement[START_ELEMENT, pos:4
82      name:pre
83      attributes: empty
84    ]
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]
89  block tags: empty
90]
91*/
92
93    /**
94     * abc{@code  def  }ghi
95     */
96    public void no_pre_extra_whitespace() { }
97/*
98DocComment[DOC_COMMENT, pos:1
99  firstSentence: 3
100    Text[TEXT, pos:1, abc]
101    Literal[CODE, pos:4, _def__]
102    Text[TEXT, pos:18, ghi]
103  body: empty
104  block tags: empty
105]
106*/
107    /**
108     * <pre> abc{@code  def  }ghi</pre>
109     */
110    public void in_pre() { }
111/*
112DocComment[DOC_COMMENT, pos:1
113  firstSentence: 4
114    StartElement[START_ELEMENT, pos:1
115      name:pre
116      attributes: empty
117    ]
118    Text[TEXT, pos:6, _abc]
119    Literal[CODE, pos:10, _def__]
120    Text[TEXT, pos:24, ghi]
121  body: 1
122    EndElement[END_ELEMENT, pos:27, pre]
123  block tags: empty
124]
125*/
126    /**
127     * <pre> abc{@code
128     * def  }ghi</pre>
129     */
130    public void in_pre_with_space_nl() { }
131/*
132DocComment[DOC_COMMENT, pos:1
133  firstSentence: 4
134    StartElement[START_ELEMENT, pos:1
135      name:pre
136      attributes: empty
137    ]
138    Text[TEXT, pos:6, _abc]
139    Literal[CODE, pos:10, |_def__]
140    Text[TEXT, pos:24, ghi]
141  body: 1
142    EndElement[END_ELEMENT, pos:27, pre]
143  block tags: empty
144]
145*/
146
147    /**
148     * <pre> abc{@code
149     *def  }ghi</pre>
150     */
151    public void in_pre_with_nl() { }
152/*
153DocComment[DOC_COMMENT, pos:1
154  firstSentence: 4
155    StartElement[START_ELEMENT, pos:1
156      name:pre
157      attributes: empty
158    ]
159    Text[TEXT, pos:6, _abc]
160    Literal[CODE, pos:10, |def__]
161    Text[TEXT, pos:23, ghi]
162  body: 1
163    EndElement[END_ELEMENT, pos:26, pre]
164  block tags: empty
165]
166*/
167    /**
168     * abc {@code
169     */
170    public void bad_code_no_content() { }
171/*
172DocComment[DOC_COMMENT, pos:1
173  firstSentence: 2
174    Text[TEXT, pos:1, abc_]
175    Erroneous[ERRONEOUS, pos:5
176      code: compiler.err.dc.unterminated.inline.tag
177      body: {@code
178    ]
179  body: empty
180  block tags: empty
181]
182*/
183    /**
184     * abc {@code abc
185     */
186    public void bad_code_content() { }
187/*
188DocComment[DOC_COMMENT, pos:1
189  firstSentence: 2
190    Text[TEXT, pos:1, abc_]
191    Erroneous[ERRONEOUS, pos:5
192      code: compiler.err.dc.unterminated.inline.tag
193      body: {@code_abc
194    ]
195  body: empty
196  block tags: empty
197]
198*/
199}
200