test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 55339 0530705ca300
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 53097
diff changeset
     2
 * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
55339
0530705ca300 8223364: Bad placement of anchor relative to header
hannesw
parents: 55232
diff changeset
    26
 * @bug      4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 8223364
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary  Make sure that annotation types with 0 members does not have
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 *           extra HR tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * @author   jamieh
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    30
 * @library  ../../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36038
diff changeset
    31
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    32
 * @build    javadoc.tester.*
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @run main TestAnnotationTypes
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    36
import javadoc.tester.JavadocTester;
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    37
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
public class TestAnnotationTypes extends JavadocTester {
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    40
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
        TestAnnotationTypes tester = new TestAnnotationTypes();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    42
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    46
    public void test() {
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    47
        javadoc("-d", "out-1",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
                "pkg");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
        checkOutput("pkg/AnnotationTypeField.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
                "<li>Summary:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
                + "<li><a href=\"#annotation.type."
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
                + "field.summary\">Field</a>&nbsp;|&nbsp;</li>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
                "<li>Detail:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    57
                + "<li><a href=\"#annotation.type."
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
                + "field.detail\">Field</a>&nbsp;|&nbsp;</li>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    59
                "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->",
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
    60
                "<h2>Field Summary</h2>",
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 47216
diff changeset
    61
                "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 36709
diff changeset
    62
                + "</code></th>",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    63
                "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
55339
0530705ca300 8223364: Bad placement of anchor relative to header
hannesw
parents: 55232
diff changeset
    64
                "<h3><a id=\"DEFAULT_NAME\">DEFAULT_NAME</a></h3>\n"
55197
0ca8e495bbba 8214126: Method signatures not formatted correctly in browser
hannesw
parents: 54958
diff changeset
    65
                + "<div class=\"memberSignature\"><span class=\"modifiers\">static final</span>&nbsp;"
0ca8e495bbba 8214126: Method signatures not formatted correctly in browser
hannesw
parents: 54958
diff changeset
    66
                + "<span class=\"returnType\">java.lang.String</span>&nbsp;"
0ca8e495bbba 8214126: Method signatures not formatted correctly in browser
hannesw
parents: 54958
diff changeset
    67
                + "<span class=\"memberName\">DEFAULT_NAME</span></div>\n");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    69
        checkOutput("pkg/AnnotationType.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    70
                "<li>Summary:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    71
                + "<li>Field&nbsp;|&nbsp;</li>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    72
                "<li>Detail:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    73
                + "<li>Field&nbsp;|&nbsp;</li>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    74
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    75
        checkOutput("pkg/AnnotationType.html", true,
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    76
                    "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    77
                    "<ul class=\"blockList\">",
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 53991
diff changeset
    78
                    "<li class=\"blockList\">",
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 53991
diff changeset
    79
                    "<section class=\"memberDetails\">",
54958
55bfc2eee3ab 8223733: "Detail" in headings should be "Details"
pmuthuswamy
parents: 54596
diff changeset
    80
                    "<h2>Element Details</h2>",
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 53991
diff changeset
    81
                    "<a id=\"annotation.type.element.detail\">",
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    82
                    "<!--   -->",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    83
                    "</a>",
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 53991
diff changeset
    84
                    "<ul class=\"blockList\">",
55232
9b392b044f64 8221709: replace use of style blockListLast
hannesw
parents: 55197
diff changeset
    85
                    "<li class=\"blockList\">",
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 53991
diff changeset
    86
                    "<section class=\"detail\">",
55339
0530705ca300 8223364: Bad placement of anchor relative to header
hannesw
parents: 55232
diff changeset
    87
                    "<h3><a id=\"value()\">value</a></h3>",
55197
0ca8e495bbba 8214126: Method signatures not formatted correctly in browser
hannesw
parents: 54958
diff changeset
    88
                    "<div class=\"memberSignature\"><span class=\"returnType\">int</span>"
0ca8e495bbba 8214126: Method signatures not formatted correctly in browser
hannesw
parents: 54958
diff changeset
    89
                    + "&nbsp;<span class=\"memberName\">value</span></div>");
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    90
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    91
        checkOutput("pkg/AnnotationType.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    92
                "<HR>\n\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    93
                + "<P>\n\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    94
                + "<P>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    95
                + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>");
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    96
    }
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    97
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48654
diff changeset
    98
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 49139
diff changeset
    99
    public void testLinkSource() {
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   100
        javadoc("-d", "out-2",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   101
                "-linksource",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   102
                "-sourcepath", testSrc,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   103
                "pkg");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   104
        checkExit(Exit.OK);
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   105
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   106
        checkOutput("src-html/pkg/AnnotationType.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   107
                "<title>Source code</title>",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   108
                "@Documented public @interface AnnotationType {");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   109
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   110
        checkOutput("src-html/pkg/AnnotationTypeField.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   111
                "<title>Source code</title>",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   112
                "@Documented public @interface AnnotationTypeField {");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   113
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   114
        checkOutput("pkg/AnnotationType.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   115
                "public @interface <a href=\"../src-html/pkg/AnnotationType.html#line.34"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   116
                + "\">AnnotationType</a></pre>");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   117
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   118
        checkOutput("pkg/AnnotationTypeField.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   119
                "public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   120
                + "\">AnnotationTypeField</a></pre>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
}