test/com/sun/javadoc/InheritDocForUserTags/DocTest.java

Tue, 14 May 2013 10:14:54 -0700

author
jjg
date
Tue, 14 May 2013 10:14:54 -0700
changeset 1743
6a5288a298fd
parent 0
959103a6100f
permissions
-rw-r--r--

8012175: Convert TagletOutputImpl to use ContentBuilder instead of StringBuilder
Reviewed-by: darcy

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 */
aoqi@0 23
aoqi@0 24 /*
aoqi@0 25 * @test
aoqi@0 26 * @bug 8008768
aoqi@0 27 * @summary Using {@inheritDoc} in simple tag defined via -tag fails
aoqi@0 28 * @author Mike Duigou
aoqi@0 29 * @run main DocTest
aoqi@0 30 */
aoqi@0 31
aoqi@0 32 import java.io.*;
aoqi@0 33
aoqi@0 34 /**
aoqi@0 35 * DocTest documentation.
aoqi@0 36 *
aoqi@0 37 * @apiNote DocTest API note.
aoqi@0 38 * @implSpec DocTest implementation spec.
aoqi@0 39 * @implNote DocTest implementation note.
aoqi@0 40 */
aoqi@0 41 public class DocTest {
aoqi@0 42 public static void main(String... args) throws Exception {
aoqi@0 43 String[] javadoc_args = {
aoqi@0 44 "-verbose",
aoqi@0 45 "-d", "DocTest",
aoqi@0 46 "-tag", "apiNote:optcm:<em>API Note</em>",
aoqi@0 47 "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
aoqi@0 48 "-tag", "implNote:optcm:<em>Implementation Note</em>:",
aoqi@0 49 "-package",
aoqi@0 50 new File(System.getProperty("test.src"), "DocTest.java").getPath()
aoqi@0 51 };
aoqi@0 52
aoqi@0 53 // javadoc does not report an exit code for an internal exception (!)
aoqi@0 54 // so monitor stderr for stack dumps.
aoqi@0 55 PrintStream prevErr = System.err;
aoqi@0 56 ByteArrayOutputStream err_baos = new ByteArrayOutputStream();
aoqi@0 57 PrintStream err_ps = new PrintStream(err_baos);
aoqi@0 58 System.setErr(err_ps);
aoqi@0 59
aoqi@0 60 int rc;
aoqi@0 61 try {
aoqi@0 62 rc = com.sun.tools.javadoc.Main.execute(javadoc_args);
aoqi@0 63 } finally {
aoqi@0 64 err_ps.close();
aoqi@0 65 System.setErr(prevErr);
aoqi@0 66 }
aoqi@0 67
aoqi@0 68 String err = err_baos.toString();
aoqi@0 69 System.err.println(err);
aoqi@0 70
aoqi@0 71 if (rc != 0)
aoqi@0 72 throw new Exception("javadoc exited with rc=" + rc);
aoqi@0 73
aoqi@0 74 if (err.contains("at com.sun."))
aoqi@0 75 throw new Exception("javadoc output contains stack trace");
aoqi@0 76 }
aoqi@0 77
aoqi@0 78 /**
aoqi@0 79 * DocTest() documentation.
aoqi@0 80 *
aoqi@0 81 * @apiNote DocTest() API note.
aoqi@0 82 * @implSpec DocTest() implementation spec.
aoqi@0 83 * @implNote DocTest() implementation note.
aoqi@0 84 */
aoqi@0 85 public DocTest() {
aoqi@0 86 }
aoqi@0 87
aoqi@0 88 /**
aoqi@0 89 * DocTest.testMethod() documentation.
aoqi@0 90 *
aoqi@0 91 * @apiNote DocTest.testMethod() API note.
aoqi@0 92 * @implSpec DocTest.testMethod() implementation spec.
aoqi@0 93 * @implNote DocTest.testMethod() implementation note.
aoqi@0 94 */
aoqi@0 95 public void testMethod() {
aoqi@0 96 }
aoqi@0 97 }
aoqi@0 98
aoqi@0 99 /**
aoqi@0 100 * DocTestWithTags documentation.
aoqi@0 101 *
aoqi@0 102 * @apiNote DocTestWithTags API note.
aoqi@0 103 * <pre>
aoqi@0 104 * DocTestWithTags API note code sample.
aoqi@0 105 * </pre>
aoqi@0 106 * @implSpec DocTestWithTags implementation spec.
aoqi@0 107 * <pre>
aoqi@0 108 * DocTestWithTags implementation spec code sample.
aoqi@0 109 * </pre>
aoqi@0 110 * @implNote DocTestWithTags implementation note.
aoqi@0 111 * <pre>
aoqi@0 112 * DocTestWithTags implementation note code sample.
aoqi@0 113 * </pre>
aoqi@0 114 */
aoqi@0 115 class DocTestWithTags {
aoqi@0 116
aoqi@0 117 /**
aoqi@0 118 * DocTestWithTags() documentation.
aoqi@0 119 *
aoqi@0 120 * @apiNote DocTestWithTags() API note.
aoqi@0 121 * <pre>
aoqi@0 122 * DocTestWithTags() API note code sample.
aoqi@0 123 * </pre>
aoqi@0 124 * @implSpec DocTestWithTags() implementation spec.
aoqi@0 125 * <pre>
aoqi@0 126 * DocTestWithTags() implementation spec code sample.
aoqi@0 127 * </pre>
aoqi@0 128 * @implNote DocTest() implementation note.
aoqi@0 129 * <pre>
aoqi@0 130 * DocTest() implementation note code sample.
aoqi@0 131 * </pre>
aoqi@0 132 */
aoqi@0 133 public DocTestWithTags() {
aoqi@0 134 }
aoqi@0 135
aoqi@0 136 /**
aoqi@0 137 * DocTest.testMethod() documentation.
aoqi@0 138 *
aoqi@0 139 * @apiNote DocTestWithTags.testMethod() API note.
aoqi@0 140 * <pre>
aoqi@0 141 * DocTestWithTags.testMethod() API note code sample.
aoqi@0 142 * </pre>
aoqi@0 143 * @implSpec DocTestWithTags.testMethod() implementation spec.
aoqi@0 144 * <pre>
aoqi@0 145 * DocTestWithTags.testMethod() API implementation spec code sample.
aoqi@0 146 * </pre>
aoqi@0 147 * @implNote DocTest.testMethod() implementation note.
aoqi@0 148 * <pre>
aoqi@0 149 * DocTest.testMethod() API implementation code sample.
aoqi@0 150 * </pre>
aoqi@0 151 */
aoqi@0 152 public void testMethod() {
aoqi@0 153 }
aoqi@0 154 }
aoqi@0 155
aoqi@0 156 class MinimallyExtendsDocTest extends DocTest {
aoqi@0 157 }
aoqi@0 158
aoqi@0 159 /**
aoqi@0 160 * SimpleExtendsDocTest documentation.
aoqi@0 161 */
aoqi@0 162 class SimpleExtendsDocTest extends DocTest {
aoqi@0 163
aoqi@0 164 /**
aoqi@0 165 * SimpleExtendsDocTest() documentation.
aoqi@0 166 */
aoqi@0 167 public SimpleExtendsDocTest() {
aoqi@0 168
aoqi@0 169 }
aoqi@0 170
aoqi@0 171 /**
aoqi@0 172 * SimpleExtendsDocTest.testMethod() documenation.
aoqi@0 173 */
aoqi@0 174 @java.lang.Override
aoqi@0 175 public void testMethod() {
aoqi@0 176 }
aoqi@0 177 }
aoqi@0 178
aoqi@0 179 /**
aoqi@0 180 * {@inheritDoc}
aoqi@0 181 */
aoqi@0 182 class SimpleInheritDocDocTest extends DocTest {
aoqi@0 183
aoqi@0 184 /**
aoqi@0 185 * {@inheritDoc}
aoqi@0 186 */
aoqi@0 187 public SimpleInheritDocDocTest() {
aoqi@0 188 }
aoqi@0 189
aoqi@0 190 /**
aoqi@0 191 * {@inheritDoc}
aoqi@0 192 */
aoqi@0 193 @java.lang.Override
aoqi@0 194 public void testMethod() {
aoqi@0 195 }
aoqi@0 196 }
aoqi@0 197
aoqi@0 198 /**
aoqi@0 199 * {@inheritDoc}
aoqi@0 200 *
aoqi@0 201 * @apiNote {@inheritDoc}
aoqi@0 202 * @implSpec {@inheritDoc}
aoqi@0 203 * @implNote {@inheritDoc}
aoqi@0 204 */
aoqi@0 205 class FullInheritDocDocTest extends DocTest {
aoqi@0 206
aoqi@0 207 /**
aoqi@0 208 * {@inheritDoc}
aoqi@0 209 *
aoqi@0 210 * @apiNote {@inheritDoc}
aoqi@0 211 * @implSpec {@inheritDoc}
aoqi@0 212 * @implNote {@inheritDoc}
aoqi@0 213 */
aoqi@0 214 public FullInheritDocDocTest() {
aoqi@0 215
aoqi@0 216 }
aoqi@0 217
aoqi@0 218 /**
aoqi@0 219 * {@inheritDoc}
aoqi@0 220 *
aoqi@0 221 * @apiNote {@inheritDoc}
aoqi@0 222 * @implSpec {@inheritDoc}
aoqi@0 223 * @implNote {@inheritDoc}
aoqi@0 224 */
aoqi@0 225 @java.lang.Override
aoqi@0 226 public void testMethod() {
aoqi@0 227 }
aoqi@0 228 }
aoqi@0 229
aoqi@0 230 /**
aoqi@0 231 * {@inheritDoc} and FullInheritDocPlusDocTest documentation.
aoqi@0 232 *
aoqi@0 233 * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest API note.
aoqi@0 234 * @implNote {@inheritDoc} and FullInheritDocPlusDocTest implementation specification.
aoqi@0 235 * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest implementation note.
aoqi@0 236 */
aoqi@0 237 class FullInheritDocPlusDocTest extends DocTest {
aoqi@0 238
aoqi@0 239 /**
aoqi@0 240 * {@inheritDoc} and FullInheritDocPlusDocTest() documentation.
aoqi@0 241 *
aoqi@0 242 * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest() API note.
aoqi@0 243 * @implNote {@inheritDoc} and FullInheritDocPlusDocTest() implementation specification.
aoqi@0 244 * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest() implementation note.
aoqi@0 245 */
aoqi@0 246 public FullInheritDocPlusDocTest() {
aoqi@0 247
aoqi@0 248 }
aoqi@0 249
aoqi@0 250 /**
aoqi@0 251 * {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() documentation.
aoqi@0 252 *
aoqi@0 253 * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() API note.
aoqi@0 254 * @implNote {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() implementation specification.
aoqi@0 255 * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() implementation note.
aoqi@0 256 */
aoqi@0 257 @java.lang.Override
aoqi@0 258 public void testMethod() {
aoqi@0 259 }
aoqi@0 260 }
aoqi@0 261

mercurial