langtools/test/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java
author ksrini
Mon, 14 Mar 2016 15:04:57 -0700
changeset 36705 890c250d8da8
parent 36038 39c5445924b9
child 36709 f9f252088afa
permissions -rw-r--r--
8071982: Update tests for revamped Doclet API 8071984: Update test cases for repeating and type annotations output in javadoc Reviewed-by: ksrini, bpatel Contributed-by: oleg.barbashov@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
     2
 * Copyright (c) 2004, 2016, 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
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    26
 * @bug      4973609 8015249 8025633 8026567 6469561 8071982
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
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    30
 * @library  ../lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
    31
 * @modules jdk.javadoc
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    32
 * @build    JavadocTester
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
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
public class TestAnnotationTypes extends JavadocTester {
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    38
    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
    39
        TestAnnotationTypes tester = new TestAnnotationTypes();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    40
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    42
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
    void test() {
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    45
        javadoc("-d", "out-1",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
                "pkg");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
        checkOutput("pkg/AnnotationTypeField.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
                "<li>Summary:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
                + "<li><a href=\"#annotation.type."
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
                + "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
    54
                "<li>Detail:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
                + "<li><a href=\"#annotation.type."
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
                + "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
    57
                "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
                "<h3>Field Summary</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    59
                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    60
                + "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    61
                + "</code>&nbsp;</td>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    62
                "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    63
                "<h4>DEFAULT_NAME</h4>\n"
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    64
                + "<pre>static final&nbsp;java."
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    65
                + "lang.String&nbsp;DEFAULT_NAME</pre>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
        checkOutput("pkg/AnnotationType.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    68
                "<li>Summary:&nbsp;</li>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    69
                + "<li>Field&nbsp;|&nbsp;</li>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    70
                "<li>Detail:&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
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    73
        checkOutput("pkg/AnnotationType.html", true,
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    74
                    "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    75
                    "<ul class=\"blockList\">",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    76
                    "<li class=\"blockList\"><a name=\"annotation.type.element.detail\">",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    77
                    "<!--   -->",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    78
                    "</a>",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    79
                    "<h3>Element Detail</h3>",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    80
                    "<a name=\"value--\">",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    81
                    "<!--   -->",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    82
                    "</a>",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    83
                    "<ul class=\"blockListLast\">",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    84
                    "<li class=\"blockList\">",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    85
                    "<h4>value</h4>",
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    86
                    "<pre>int&nbsp;value</pre>" );
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
    87
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    88
        checkOutput("pkg/AnnotationType.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    89
                "<HR>\n\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    90
                + "<P>\n\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    91
                + "<P>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    92
                + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>");
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    93
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    94
        javadoc("-d", "out-2",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    95
                "-linksource",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    96
                "-sourcepath", testSrc,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    97
                "pkg");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    98
        checkExit(Exit.OK);
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
    99
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   100
        checkOutput("src-html/pkg/AnnotationType.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   101
                "<title>Source code</title>",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   102
                "@Documented public @interface AnnotationType {");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   103
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   104
        checkOutput("src-html/pkg/AnnotationTypeField.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   105
                "<title>Source code</title>",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   106
                "@Documented public @interface AnnotationTypeField {");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   107
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   108
        checkOutput("pkg/AnnotationType.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   109
                "public @interface <a href=\"../src-html/pkg/AnnotationType.html#line.34"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   110
                + "\">AnnotationType</a></pre>");
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   111
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   112
        checkOutput("pkg/AnnotationTypeField.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   113
                "public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 36038
diff changeset
   114
                + "\">AnnotationTypeField</a></pre>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
}