test/tools/javac/doctree/FirstSentenceTest.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/doctree/FirstSentenceTest.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,198 @@
     1.4 +/*
     1.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + */
    1.26 +
    1.27 +/*
    1.28 + * @test
    1.29 + * @bug 7021614
    1.30 + * @summary extend com.sun.source API to support parsing javadoc comments
    1.31 + * @build DocCommentTester
    1.32 + * @run main DocCommentTester FirstSentenceTest.java
    1.33 + */
    1.34 +
    1.35 +class FirstSentenceTest {
    1.36 +    /** */
    1.37 +    void empty() { }
    1.38 +/*
    1.39 +DocComment[DOC_COMMENT, pos:-1
    1.40 +  firstSentence: empty
    1.41 +  body: empty
    1.42 +  block tags: empty
    1.43 +]
    1.44 +*/
    1.45 +
    1.46 +    /** abc def ghi */
    1.47 +    void no_terminator() { }
    1.48 +/*
    1.49 +DocComment[DOC_COMMENT, pos:0
    1.50 +  firstSentence: 1
    1.51 +    Text[TEXT, pos:0, abc_def_ghi]
    1.52 +  body: empty
    1.53 +  block tags: empty
    1.54 +]
    1.55 +*/
    1.56 +
    1.57 +    /**
    1.58 +     * abc def ghi.
    1.59 +     */
    1.60 +    void no_body() { }
    1.61 +/*
    1.62 +DocComment[DOC_COMMENT, pos:1
    1.63 +  firstSentence: 1
    1.64 +    Text[TEXT, pos:1, abc_def_ghi.]
    1.65 +  body: empty
    1.66 +  block tags: empty
    1.67 +]
    1.68 +*/
    1.69 +
    1.70 +    /**
    1.71 +     * abc def ghi. jkl mno pqr.
    1.72 +     */
    1.73 +    void dot_space() { }
    1.74 +/*
    1.75 +DocComment[DOC_COMMENT, pos:1
    1.76 +  firstSentence: 1
    1.77 +    Text[TEXT, pos:1, abc_def_ghi.]
    1.78 +  body: 1
    1.79 +    Text[TEXT, pos:14, jkl_mno_pqr.]
    1.80 +  block tags: empty
    1.81 +]
    1.82 +*/
    1.83 +
    1.84 +    /**
    1.85 +     * abc def ghi.
    1.86 +     * jkl mno pqr
    1.87 +     */
    1.88 +    void dot_newline() { }
    1.89 +/*
    1.90 +DocComment[DOC_COMMENT, pos:1
    1.91 +  firstSentence: 1
    1.92 +    Text[TEXT, pos:1, abc_def_ghi.]
    1.93 +  body: 1
    1.94 +    Text[TEXT, pos:15, jkl_mno_pqr]
    1.95 +  block tags: empty
    1.96 +]
    1.97 +*/
    1.98 +
    1.99 +    /**
   1.100 +     * abc def ghi
   1.101 +     * <p>jkl mno pqr
   1.102 +     */
   1.103 +    void dot_p() { }
   1.104 +/*
   1.105 +DocComment[DOC_COMMENT, pos:1
   1.106 +  firstSentence: 1
   1.107 +    Text[TEXT, pos:1, abc_def_ghi]
   1.108 +  body: 2
   1.109 +    StartElement[START_ELEMENT, pos:14
   1.110 +      name:p
   1.111 +      attributes: empty
   1.112 +    ]
   1.113 +    Text[TEXT, pos:17, jkl_mno_pqr]
   1.114 +  block tags: empty
   1.115 +]
   1.116 +*/
   1.117 +
   1.118 +    /**
   1.119 +     * abc def ghi
   1.120 +     * </p>jkl mno pqr
   1.121 +     */
   1.122 +    void dot_end_p() { }
   1.123 +/*
   1.124 +DocComment[DOC_COMMENT, pos:1
   1.125 +  firstSentence: 1
   1.126 +    Text[TEXT, pos:1, abc_def_ghi]
   1.127 +  body: 2
   1.128 +    EndElement[END_ELEMENT, pos:14, p]
   1.129 +    Text[TEXT, pos:18, jkl_mno_pqr]
   1.130 +  block tags: empty
   1.131 +]
   1.132 +*/
   1.133 +
   1.134 +    /**
   1.135 +     * abc &lt; ghi. jkl mno pqr.
   1.136 +     */
   1.137 +    void entity() { }
   1.138 +/*
   1.139 +DocComment[DOC_COMMENT, pos:1
   1.140 +  firstSentence: 3
   1.141 +    Text[TEXT, pos:1, abc_]
   1.142 +    Entity[ENTITY, pos:5, lt]
   1.143 +    Text[TEXT, pos:9, _ghi.]
   1.144 +  body: 1
   1.145 +    Text[TEXT, pos:15, jkl_mno_pqr.]
   1.146 +  block tags: empty
   1.147 +]
   1.148 +*/
   1.149 +
   1.150 +    /**
   1.151 +     * abc {@code code} ghi. jkl mno pqr.
   1.152 +     */
   1.153 +    void inline_tag() { }
   1.154 +/*
   1.155 +DocComment[DOC_COMMENT, pos:1
   1.156 +  firstSentence: 3
   1.157 +    Text[TEXT, pos:1, abc_]
   1.158 +    Literal[CODE, pos:5, code]
   1.159 +    Text[TEXT, pos:17, _ghi.]
   1.160 +  body: 1
   1.161 +    Text[TEXT, pos:23, jkl_mno_pqr.]
   1.162 +  block tags: empty
   1.163 +]
   1.164 +*/
   1.165 +
   1.166 +    /**
   1.167 +     * abc def ghi
   1.168 +     * @author jjg
   1.169 +     */
   1.170 +    void block_tag() { }
   1.171 +/*
   1.172 +DocComment[DOC_COMMENT, pos:1
   1.173 +  firstSentence: 1
   1.174 +    Text[TEXT, pos:1, abc_def_ghi]
   1.175 +  body: empty
   1.176 +  block tags: 1
   1.177 +    Author[AUTHOR, pos:14
   1.178 +      name: 1
   1.179 +        Text[TEXT, pos:22, jjg]
   1.180 +    ]
   1.181 +]
   1.182 +*/
   1.183 +
   1.184 +    /**
   1.185 +     * @author jjg
   1.186 +     */
   1.187 +    void just_tag() { }
   1.188 +/*
   1.189 +DocComment[DOC_COMMENT, pos:1
   1.190 +  firstSentence: empty
   1.191 +  body: empty
   1.192 +  block tags: 1
   1.193 +    Author[AUTHOR, pos:1
   1.194 +      name: 1
   1.195 +        Text[TEXT, pos:9, jjg]
   1.196 +    ]
   1.197 +]
   1.198 +*/
   1.199 +
   1.200 +}
   1.201 +

mercurial