1 /* 2 * Copyright (c) 2013, 2019, 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 8008768 27 * @summary Using {@inheritDoc} in simple tag defined via -tag fails 28 * @library ../../lib 29 * @modules jdk.javadoc/jdk.javadoc.internal.tool 30 * @build javadoc.tester.* 31 * @run main DocTest 32 */ 33 34 import javadoc.tester.JavadocTester; 35 36 /** 37 * DocTest documentation. 38 * 39 * @apiNote DocTest API note. 40 * @implSpec DocTest implementation spec. 41 * @implNote DocTest implementation note. 42 */ 43 public class DocTest extends JavadocTester { main(String... args)44 public static void main(String... args) throws Exception { 45 DocTest tester = new DocTest(); 46 tester.runTests(); 47 } 48 49 @Test test()50 public void test() { 51 javadoc("-verbose", 52 "-d", "DocTest", 53 "-sourcepath", System.getProperty("test.src.path"), 54 "-tag", "apiNote:optcm:<em>API Note</em>", 55 "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:", 56 "-tag", "implNote:optcm:<em>Implementation Note</em>:", 57 "-package", 58 testSrc("DocTest.java") 59 ); 60 checkExit(Exit.OK); 61 62 // javadoc does not report an exit code for an internal exception (!) 63 // so monitor stderr for stack dumps. 64 checkOutput(Output.STDERR, false, "at com.sun"); 65 } 66 67 /** 68 * DocTest() documentation. 69 * 70 * @apiNote DocTest() API note. 71 * @implSpec DocTest() implementation spec. 72 * @implNote DocTest() implementation note. 73 */ DocTest()74 public DocTest() { 75 } 76 77 /** 78 * DocTest.testMethod() documentation. 79 * 80 * @apiNote DocTest.testMethod() API note. 81 * @implSpec DocTest.testMethod() implementation spec. 82 * @implNote DocTest.testMethod() implementation note. 83 */ testMethod()84 public void testMethod() { 85 } 86 } 87 88 /** 89 * DocTestWithTags documentation. 90 * 91 * @apiNote DocTestWithTags API note. 92 * <pre> 93 * DocTestWithTags API note code sample. 94 * </pre> 95 * @implSpec DocTestWithTags implementation spec. 96 * <pre> 97 * DocTestWithTags implementation spec code sample. 98 * </pre> 99 * @implNote DocTestWithTags implementation note. 100 * <pre> 101 * DocTestWithTags implementation note code sample. 102 * </pre> 103 */ 104 class DocTestWithTags { 105 106 /** 107 * DocTestWithTags() documentation. 108 * 109 * @apiNote DocTestWithTags() API note. 110 * <pre> 111 * DocTestWithTags() API note code sample. 112 * </pre> 113 * @implSpec DocTestWithTags() implementation spec. 114 * <pre> 115 * DocTestWithTags() implementation spec code sample. 116 * </pre> 117 * @implNote DocTest() implementation note. 118 * <pre> 119 * DocTest() implementation note code sample. 120 * </pre> 121 */ DocTestWithTags()122 public DocTestWithTags() { 123 } 124 125 /** 126 * DocTest.testMethod() documentation. 127 * 128 * @apiNote DocTestWithTags.testMethod() API note. 129 * <pre> 130 * DocTestWithTags.testMethod() API note code sample. 131 * </pre> 132 * @implSpec DocTestWithTags.testMethod() implementation spec. 133 * <pre> 134 * DocTestWithTags.testMethod() API implementation spec code sample. 135 * </pre> 136 * @implNote DocTest.testMethod() implementation note. 137 * <pre> 138 * DocTest.testMethod() API implementation code sample. 139 * </pre> 140 */ testMethod()141 public void testMethod() { 142 } 143 } 144 145 class MinimallyExtendsDocTest extends DocTest { 146 } 147 148 /** 149 * SimpleExtendsDocTest documentation. 150 */ 151 class SimpleExtendsDocTest extends DocTest { 152 153 /** 154 * SimpleExtendsDocTest() documentation. 155 */ SimpleExtendsDocTest()156 public SimpleExtendsDocTest() { 157 158 } 159 160 /** 161 * SimpleExtendsDocTest.testMethod() documenation. 162 */ 163 @java.lang.Override testMethod()164 public void testMethod() { 165 } 166 } 167 168 /** 169 * {@inheritDoc} 170 */ 171 class SimpleInheritDocDocTest extends DocTest { 172 173 /** 174 * {@inheritDoc} 175 */ SimpleInheritDocDocTest()176 public SimpleInheritDocDocTest() { 177 } 178 179 /** 180 * {@inheritDoc} 181 */ 182 @java.lang.Override testMethod()183 public void testMethod() { 184 } 185 } 186 187 /** 188 * {@inheritDoc} 189 * 190 * @apiNote {@inheritDoc} 191 * @implSpec {@inheritDoc} 192 * @implNote {@inheritDoc} 193 */ 194 class FullInheritDocDocTest extends DocTest { 195 196 /** 197 * {@inheritDoc} 198 * 199 * @apiNote {@inheritDoc} 200 * @implSpec {@inheritDoc} 201 * @implNote {@inheritDoc} 202 */ FullInheritDocDocTest()203 public FullInheritDocDocTest() { 204 205 } 206 207 /** 208 * {@inheritDoc} 209 * 210 * @apiNote {@inheritDoc} 211 * @implSpec {@inheritDoc} 212 * @implNote {@inheritDoc} 213 */ 214 @java.lang.Override testMethod()215 public void testMethod() { 216 } 217 } 218 219 /** 220 * {@inheritDoc} and FullInheritDocPlusDocTest documentation. 221 * 222 * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest API note. 223 * @implNote {@inheritDoc} and FullInheritDocPlusDocTest implementation specification. 224 * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest implementation note. 225 */ 226 class FullInheritDocPlusDocTest extends DocTest { 227 228 /** 229 * {@inheritDoc} and FullInheritDocPlusDocTest() documentation. 230 * 231 * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest() API note. 232 * @implNote {@inheritDoc} and FullInheritDocPlusDocTest() implementation specification. 233 * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest() implementation note. 234 */ FullInheritDocPlusDocTest()235 public FullInheritDocPlusDocTest() { 236 237 } 238 239 /** 240 * {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() documentation. 241 * 242 * @implSpec {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() API note. 243 * @implNote {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() implementation specification. 244 * @apiNote {@inheritDoc} and FullInheritDocPlusDocTest.testMethod() implementation note. 245 */ 246 @java.lang.Override testMethod()247 public void testMethod() { 248 } 249 } 250 251