langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java
author jjg
Tue, 22 Apr 2014 17:57:40 -0700
changeset 24072 e7549dcbc4af
parent 24065 fc4022e50129
child 24399 af1a0220d0fa
permissions -rw-r--r--
8040903: Clean up use of BUG_ID in javadoc tests Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     1
/*
23799
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 23139
diff changeset
     2
 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     4
 *
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     8
 *
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    13
 * accompanied this code).
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    14
 *
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    18
 *
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    21
 * questions.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    22
 */
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    23
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    24
/*
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    25
 * @test
23799
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 23139
diff changeset
    26
 * @bug      8004893 8022738 8029143
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    27
 * @summary  Make sure that the lambda feature changes work fine in
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    28
 *           javadoc.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    29
 * @author   bpatel
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    30
 * @library  ../lib/
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    31
 * @build    JavadocTester TestLambdaFeature
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    32
 * @run main TestLambdaFeature
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    33
 */
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    34
23139
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    35
/*
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    36
 * NOTE : This test should be elided when version 1.7 support is removed from the JDK
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    37
 *              or the negative part of the test showing 1.7's non-support should be
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    38
 *              removed [ 8022738 ]
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    39
 */
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    40
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    41
public class TestLambdaFeature extends JavadocTester {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    42
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    43
    //Javadoc arguments.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    44
    private static final String[] ARGS = new String[] {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    45
        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", "pkg1"
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    46
    };
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    47
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    48
    private static final String[] ARGS_1 = new String[] {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    49
        "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-source", "1.7", "pkg1"
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    50
    };
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    51
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    52
    //Input for string search tests.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    53
    private static final String[][] TEST = {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    54
        { "pkg/A.html",
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    55
            "<td class=\"colFirst\"><code>default void</code></td>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    56
        { "pkg/A.html",
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    57
            "<pre>default&nbsp;void&nbsp;defaultMethod()</pre>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    58
        { "pkg/A.html",
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    59
            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    60
            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    61
            "<span id=\"t2\" class=\"tableTab\"><span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    62
            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    63
            "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    64
            "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    65
            "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    66
            "</span><span id=\"t5\" class=\"tableTab\"><span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    67
            "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    68
            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    69
        { "pkg/A.html",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    70
            "<dl>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    71
            "<dt>Functional Interface:</dt>\n" +
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    72
            "<dd>This is a functional interface and can therefore be used as " +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    73
            "the assignment target for a lambda expression or method " +
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    74
            "reference.</dd>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    75
            "</dl>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    76
        { "pkg1/FuncInf.html",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    77
            "<dl>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    78
            "<dt>Functional Interface:</dt>\n" +
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    79
            "<dd>This is a functional interface and can therefore be used as " +
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    80
            "the assignment target for a lambda expression or method " +
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    81
            "reference.</dd>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    82
            "</dl>"}
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    83
    };
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    84
    private static final String[][] NEGATED_TEST = {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    85
        { "pkg/A.html",
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    86
            "<td class=\"colFirst\"><code>default default void</code></td>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    87
        { "pkg/A.html",
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    88
            "<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    89
        { "pkg/B.html",
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    90
            "<td class=\"colFirst\"><code>default void</code></td>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    91
        { "pkg1/NotAFuncInf.html",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    92
            "<dl>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    93
            "<dt>Functional Interface:</dt>\n" +
23799
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 23139
diff changeset
    94
            "<dd>This is a functional interface and can therefore be used as " +
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 23139
diff changeset
    95
            "the assignment target for a lambda expression or method " +
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    96
            "reference.</dd>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    97
            "</dl>"},
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    98
        { "pkg/B.html",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
    99
            "<dl>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
   100
            "<dt>Functional Interface:</dt>"}
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   101
    };
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
   102
    private static final String[][] NEGATED_TEST_1 = {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
   103
        { "pkg1/FuncInf.html",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
   104
            "<dl>\n" +
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 23799
diff changeset
   105
            "<dt>Functional Interface:</dt>"}
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
   106
    };
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   107
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   108
    /**
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   109
     * The entry point of the test.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   110
     * @param args the array of command line arguments.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   111
     */
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   112
    public static void main(String[] args) {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   113
        TestLambdaFeature tester = new TestLambdaFeature();
24065
fc4022e50129 8041150: Avoid silly use of static methods in JavadocTester
jjg
parents: 23971
diff changeset
   114
        tester.run(ARGS, TEST, NEGATED_TEST);
fc4022e50129 8041150: Avoid silly use of static methods in JavadocTester
jjg
parents: 23971
diff changeset
   115
        tester.run(ARGS_1, NO_TEST, NEGATED_TEST_1);
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   116
        tester.printSummary();
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   117
    }
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   118
}