1 /* 2 * Copyright (c) 2004, 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 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 8223364 27 * @summary Make sure that annotation types with 0 members does not have 28 * extra HR tags. 29 * @library ../../lib 30 * @modules jdk.javadoc/jdk.javadoc.internal.tool 31 * @build javadoc.tester.* 32 * @run main TestAnnotationTypes 33 */ 34 35 import javadoc.tester.JavadocTester; 36 37 public class TestAnnotationTypes extends JavadocTester { 38 39 public static void main(String... args) throws Exception { 40 TestAnnotationTypes tester = new TestAnnotationTypes(); 41 tester.runTests(); 42 } 43 44 @Test 45 public void test() { 46 javadoc("-d", "out-1", 47 "-sourcepath", testSrc, 48 "pkg"); 49 checkExit(Exit.OK); 50 51 checkOutput("pkg/AnnotationTypeField.html", true, 52 "<li>Summary: </li>\n" 53 + "<li><a href=\"#annotation.type." 54 + "field.summary\">Field</a> | </li>", 55 "<li>Detail: </li>\n" 56 + "<li><a href=\"#annotation.type." 57 + "field.detail\">Field</a> | </li>", 58 "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->", 59 "<h2>Field Summary</h2>", 60 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#DEFAULT_NAME\">DEFAULT_NAME</a></span>" 61 + "</code></th>", 62 "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->", 63 "<h3><a id=\"DEFAULT_NAME\">DEFAULT_NAME</a></h3>\n" 64 + "<div class=\"memberSignature\"><span class=\"modifiers\">static final</span> " 65 + "<span class=\"returnType\">java.lang.String</span> " 66 + "<span class=\"memberName\">DEFAULT_NAME</span></div>\n"); 67 68 checkOutput("pkg/AnnotationType.html", true, 69 "<li>Summary: </li>\n" 70 + "<li>Field | </li>", 71 "<li>Detail: </li>\n" 72 + "<li>Field | </li>"); 73 74 checkOutput("pkg/AnnotationType.html", true, 75 "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->", 76 "<ul class=\"blockList\">", 77 "<li class=\"blockList\">", 78 "<section class=\"memberDetails\">", 79 "<h2>Element Details</h2>", 80 "<a id=\"annotation.type.element.detail\">", 81 "<!-- -->", 82 "</a>", 83 "<ul class=\"blockList\">", 84 "<li class=\"blockList\">", 85 "<section class=\"detail\">", 86 "<h3><a id=\"value()\">value</a></h3>", 87 "<div class=\"memberSignature\"><span class=\"returnType\">int</span>" 88 + " <span class=\"memberName\">value</span></div>"); 89 90 checkOutput("pkg/AnnotationType.html", false, 91 "<HR>\n\n" 92 + "<P>\n\n" 93 + "<P>" 94 + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"); 95 } 96 97 @Test 98 public void testLinkSource() { 99 javadoc("-d", "out-2", 100 "-linksource", 101 "-sourcepath", testSrc, 102 "pkg"); 103 checkExit(Exit.OK); 104 105 checkOutput("src-html/pkg/AnnotationType.html", true, 106 "<title>Source code</title>", 107 "@Documented public @interface AnnotationType {"); 108 109 checkOutput("src-html/pkg/AnnotationTypeField.html", true, 110 "<title>Source code</title>", 111 "@Documented public @interface AnnotationTypeField {"); 112 113 checkOutput("pkg/AnnotationType.html", true, 114 "public @interface <a href=\"../src-html/pkg/AnnotationType.html#line.31" 115 + "\">AnnotationType</a></pre>"); 116 117 checkOutput("pkg/AnnotationTypeField.html", true, 118 "public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31" 119 + "\">AnnotationTypeField</a></pre>"); 120 } 121 }