test/tools/javac/doctree/LinkTest.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/doctree/LinkTest.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,192 @@
     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 LinkTest.java
    1.33 + */
    1.34 +
    1.35 +class LinkTest {
    1.36 +    /**
    1.37 +     * abc {@link String} def
    1.38 +      */
    1.39 +    void simple_name() { }
    1.40 +/*
    1.41 +DocComment[DOC_COMMENT, pos:1
    1.42 +  firstSentence: 3
    1.43 +    Text[TEXT, pos:1, abc_]
    1.44 +    Link[LINK, pos:5
    1.45 +      reference:
    1.46 +        Reference[REFERENCE, pos:12, String]
    1.47 +      body: empty
    1.48 +    ]
    1.49 +    Text[TEXT, pos:19, _def]
    1.50 +  body: empty
    1.51 +  block tags: empty
    1.52 +]
    1.53 +*/
    1.54 +
    1.55 +    /**
    1.56 +     * abc {@link String desc} def
    1.57 +     */
    1.58 +    void simple_name_desc() { }
    1.59 +/*
    1.60 +DocComment[DOC_COMMENT, pos:1
    1.61 +  firstSentence: 3
    1.62 +    Text[TEXT, pos:1, abc_]
    1.63 +    Link[LINK, pos:5
    1.64 +      reference:
    1.65 +        Reference[REFERENCE, pos:12, String]
    1.66 +      body: 1
    1.67 +        Text[TEXT, pos:19, desc]
    1.68 +    ]
    1.69 +    Text[TEXT, pos:24, _def]
    1.70 +  body: empty
    1.71 +  block tags: empty
    1.72 +]
    1.73 +*/
    1.74 +
    1.75 +    /**
    1.76 +     * abc {@link java.lang.String desc} def
    1.77 +     */
    1.78 +    void pkg_name_desc() { }
    1.79 +/*
    1.80 +DocComment[DOC_COMMENT, pos:1
    1.81 +  firstSentence: 3
    1.82 +    Text[TEXT, pos:1, abc_]
    1.83 +    Link[LINK, pos:5
    1.84 +      reference:
    1.85 +        Reference[REFERENCE, pos:12, java.lang.String]
    1.86 +      body: 1
    1.87 +        Text[TEXT, pos:29, desc]
    1.88 +    ]
    1.89 +    Text[TEXT, pos:34, _def]
    1.90 +  body: empty
    1.91 +  block tags: empty
    1.92 +]
    1.93 +*/
    1.94 +
    1.95 +    /**
    1.96 +     * abc {@link java.lang.String#isEmpty desc} def
    1.97 +     */
    1.98 +    void method_desc() { }
    1.99 +/*
   1.100 +DocComment[DOC_COMMENT, pos:1
   1.101 +  firstSentence: 3
   1.102 +    Text[TEXT, pos:1, abc_]
   1.103 +    Link[LINK, pos:5
   1.104 +      reference:
   1.105 +        Reference[REFERENCE, pos:12, java.lang.String#isEmpty]
   1.106 +      body: 1
   1.107 +        Text[TEXT, pos:37, desc]
   1.108 +    ]
   1.109 +    Text[TEXT, pos:42, _def]
   1.110 +  body: empty
   1.111 +  block tags: empty
   1.112 +]
   1.113 +*/
   1.114 +
   1.115 +    /**
   1.116 +     * abc {@link java.lang.String#isEmpty() desc} def
   1.117 +     */
   1.118 +    void method_0_args_desc() { }
   1.119 +/*
   1.120 +DocComment[DOC_COMMENT, pos:1
   1.121 +  firstSentence: 3
   1.122 +    Text[TEXT, pos:1, abc_]
   1.123 +    Link[LINK, pos:5
   1.124 +      reference:
   1.125 +        Reference[REFERENCE, pos:12, java.lang.String#isEmpty()]
   1.126 +      body: 1
   1.127 +        Text[TEXT, pos:39, desc]
   1.128 +    ]
   1.129 +    Text[TEXT, pos:44, _def]
   1.130 +  body: empty
   1.131 +  block tags: empty
   1.132 +]
   1.133 +*/
   1.134 +
   1.135 +    /**
   1.136 +     * abc {@link java.lang.String#substring(int) desc} def
   1.137 +     */
   1.138 +    void method_1_args_desc() { }
   1.139 +/*
   1.140 +DocComment[DOC_COMMENT, pos:1
   1.141 +  firstSentence: 3
   1.142 +    Text[TEXT, pos:1, abc_]
   1.143 +    Link[LINK, pos:5
   1.144 +      reference:
   1.145 +        Reference[REFERENCE, pos:12, java.lang.String#substring(int)]
   1.146 +      body: 1
   1.147 +        Text[TEXT, pos:44, desc]
   1.148 +    ]
   1.149 +    Text[TEXT, pos:49, _def]
   1.150 +  body: empty
   1.151 +  block tags: empty
   1.152 +]
   1.153 +*/
   1.154 +
   1.155 +    /**
   1.156 +     * abc {@link java.lang.String#substring(int, int) desc} def
   1.157 +     */
   1.158 +    void method_2_args_desc() { }
   1.159 +/*
   1.160 +DocComment[DOC_COMMENT, pos:1
   1.161 +  firstSentence: 3
   1.162 +    Text[TEXT, pos:1, abc_]
   1.163 +    Link[LINK, pos:5
   1.164 +      reference:
   1.165 +        Reference[REFERENCE, pos:12, java.lang.String...#substring(int,_int)]
   1.166 +      body: 1
   1.167 +        Text[TEXT, pos:49, desc]
   1.168 +    ]
   1.169 +    Text[TEXT, pos:54, _def]
   1.170 +  body: empty
   1.171 +  block tags: empty
   1.172 +]
   1.173 +*/
   1.174 +
   1.175 +    /**
   1.176 +     * abc {@link java.util.List<T> desc} def
   1.177 +     */
   1.178 +    void pkg_name_typarams_desc() { }
   1.179 +/*
   1.180 +DocComment[DOC_COMMENT, pos:1
   1.181 +  firstSentence: 3
   1.182 +    Text[TEXT, pos:1, abc_]
   1.183 +    Link[LINK, pos:5
   1.184 +      reference:
   1.185 +        Reference[REFERENCE, pos:12, java.util.List<T>]
   1.186 +      body: 1
   1.187 +        Text[TEXT, pos:30, desc]
   1.188 +    ]
   1.189 +    Text[TEXT, pos:35, _def]
   1.190 +  body: empty
   1.191 +  block tags: empty
   1.192 +]
   1.193 +*/
   1.194 +
   1.195 +}

mercurial