FirstSentenceTest.java revision 3060:23f76aadbb36
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 FirstSentenceTest.java 34 */ 35 36class FirstSentenceTest { 37 /** */ 38 void empty() { } 39/* 40DocComment[DOC_COMMENT, pos:-1 41 firstSentence: empty 42 body: empty 43 block tags: empty 44] 45*/ 46 47 /** abc def ghi */ 48 void no_terminator() { } 49/* 50DocComment[DOC_COMMENT, pos:0 51 firstSentence: 1 52 Text[TEXT, pos:0, abc_def_ghi] 53 body: empty 54 block tags: empty 55] 56*/ 57 58 /** 59 * abc def ghi. 60 */ 61 void no_body() { } 62/* 63DocComment[DOC_COMMENT, pos:1 64 firstSentence: 1 65 Text[TEXT, pos:1, abc_def_ghi.] 66 body: empty 67 block tags: empty 68] 69*/ 70 71 /** 72 * abc def ghi. jkl mno pqr. 73 */ 74 void dot_space() { } 75/* 76DocComment[DOC_COMMENT, pos:1 77 firstSentence: 1 78 Text[TEXT, pos:1, abc_def_ghi.] 79 body: 1 80 Text[TEXT, pos:14, jkl_mno_pqr.] 81 block tags: empty 82] 83*/ 84 85 /** 86 * abc def ghi. 87 * jkl mno pqr 88 */ 89 void dot_newline() { } 90/* 91DocComment[DOC_COMMENT, pos:1 92 firstSentence: 1 93 Text[TEXT, pos:1, abc_def_ghi.] 94 body: 1 95 Text[TEXT, pos:15, jkl_mno_pqr] 96 block tags: empty 97] 98*/ 99 100 /** 101 * abc def ghi 102 * <p>jkl mno pqr 103 */ 104 void dot_p() { } 105/* 106DocComment[DOC_COMMENT, pos:1 107 firstSentence: 1 108 Text[TEXT, pos:1, abc_def_ghi] 109 body: 2 110 StartElement[START_ELEMENT, pos:14 111 name:p 112 attributes: empty 113 ] 114 Text[TEXT, pos:17, jkl_mno_pqr] 115 block tags: empty 116] 117*/ 118 119 /** 120 * 121 * <p>abc def ghi. 122 * jdl mno pqf 123 */ 124 void newline_p() { } 125/* 126DocComment[DOC_COMMENT, pos:2 127 firstSentence: 2 128 StartElement[START_ELEMENT, pos:2 129 name:p 130 attributes: empty 131 ] 132 Text[TEXT, pos:5, abc_def_ghi.] 133 body: 1 134 Text[TEXT, pos:19, jdl_mno_pqf] 135 block tags: empty 136] 137*/ 138 139 /** 140 * abc def ghi 141 * </p>jkl mno pqr 142 */ 143 void dot_end_p() { } 144/* 145DocComment[DOC_COMMENT, pos:1 146 firstSentence: 1 147 Text[TEXT, pos:1, abc_def_ghi] 148 body: 2 149 EndElement[END_ELEMENT, pos:14, p] 150 Text[TEXT, pos:18, jkl_mno_pqr] 151 block tags: empty 152] 153*/ 154 155 /** 156 * abc < ghi. jkl mno pqr. 157 */ 158 void entity() { } 159/* 160DocComment[DOC_COMMENT, pos:1 161 firstSentence: 3 162 Text[TEXT, pos:1, abc_] 163 Entity[ENTITY, pos:5, lt] 164 Text[TEXT, pos:9, _ghi.] 165 body: 1 166 Text[TEXT, pos:15, jkl_mno_pqr.] 167 block tags: empty 168] 169*/ 170 171 /** 172 * abc {@code code} ghi. jkl mno pqr. 173 */ 174 void inline_tag() { } 175/* 176DocComment[DOC_COMMENT, pos:1 177 firstSentence: 3 178 Text[TEXT, pos:1, abc_] 179 Literal[CODE, pos:5, code] 180 Text[TEXT, pos:17, _ghi.] 181 body: 1 182 Text[TEXT, pos:23, jkl_mno_pqr.] 183 block tags: empty 184] 185*/ 186 187 /** 188 * abc def ghi 189 * @author jjg 190 */ 191 void block_tag() { } 192/* 193DocComment[DOC_COMMENT, pos:1 194 firstSentence: 1 195 Text[TEXT, pos:1, abc_def_ghi] 196 body: empty 197 block tags: 1 198 Author[AUTHOR, pos:14 199 name: 1 200 Text[TEXT, pos:22, jjg] 201 ] 202] 203*/ 204 205 /** 206 * @author jjg 207 */ 208 void just_tag() { } 209/* 210DocComment[DOC_COMMENT, pos:1 211 firstSentence: empty 212 body: empty 213 block tags: 1 214 Author[AUTHOR, pos:1 215 name: 1 216 Text[TEXT, pos:9, jjg] 217 ] 218] 219*/ 220 /** 221 * <p> abc def. 222 * ghi jkl 223 */ 224 void p_at_zero() { } 225/* 226DocComment[DOC_COMMENT, pos:1 227 firstSentence: 2 228 StartElement[START_ELEMENT, pos:1 229 name:p 230 attributes: empty 231 ] 232 Text[TEXT, pos:4, _abc_def.] 233 body: 1 234 Text[TEXT, pos:15, ghi_jkl] 235 block tags: empty 236] 237*/ 238 /** 239 * abc <p> def. ghi jkl 240 */ 241 void p_at_nonzero() { } 242/* 243DocComment[DOC_COMMENT, pos:1 244 firstSentence: 1 245 Text[TEXT, pos:1, abc] 246 body: 2 247 StartElement[START_ELEMENT, pos:5 248 name:p 249 attributes: empty 250 ] 251 Text[TEXT, pos:8, _def._ghi_jkl] 252 block tags: empty 253] 254*/ 255} 256 257