langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java
author darcy
Thu, 06 Mar 2014 16:15:02 -0800
changeset 23139 612191246a7d
parent 19912 4b1a79163f9c
child 23799 daa645653200
permissions -rw-r--r--
8031670: Remove unneeded -source options in javadoc tests Reviewed-by: jjg, darcy, vromero Contributed-by: neil.toda@oracle.com
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
/*
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
     2
 * Copyright (c) 2012, 2013, 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
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    26
 * @bug      8004893 8022738
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
    //Test information.
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    44
    private static final String BUG_ID = "8004893-8022738";
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    45
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    46
    //Javadoc arguments.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    47
    private static final String[] ARGS = new String[] {
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    48
        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "pkg1"
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    49
    };
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    50
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    51
    private static final String[] ARGS_1 = new String[] {
23139
612191246a7d 8031670: Remove unneeded -source options in javadoc tests
darcy
parents: 19912
diff changeset
    52
        "-d", BUG_ID + "-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
    53
    };
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    54
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    55
    //Input for string search tests.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    56
    private static final String[][] TEST = {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    57
        {BUG_ID + FS + "pkg" + FS + "A.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    58
            "<td class=\"colFirst\"><code>default void</code></td>"},
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    59
        {BUG_ID + FS + "pkg" + FS + "A.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    60
            "<pre>default&nbsp;void&nbsp;defaultMethod()</pre>"},
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    61
        {BUG_ID + FS + "pkg" + FS + "A.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    62
            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    63
            "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
    64
            "<span id=\"t2\" class=\"tableTab\"><span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    65
            "<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
    66
            "<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
    67
            "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
    68
            "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
    69
            "</span><span id=\"t5\" class=\"tableTab\"><span>" +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    70
            "<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
    71
            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    72
        {BUG_ID + FS + "pkg" + FS + "A.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    73
            "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    74
            "<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
    75
            "the assignment target for a lambda expression or method " +
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    76
            "reference.</dd>" + NL + "</dl>"},
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    77
        {BUG_ID + FS + "pkg1" + FS + "FuncInf.html",
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    78
            "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
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 " +
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 14965
diff changeset
    81
            "reference.</dd>" + NL + "</dl>"}
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    82
    };
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    83
    private static final String[][] NEGATED_TEST = {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    84
        {BUG_ID + FS + "pkg" + FS + "A.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    85
            "<td class=\"colFirst\"><code>default default void</code></td>"},
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    86
        {BUG_ID + FS + "pkg" + FS + "A.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    87
            "<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>"},
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    88
        {BUG_ID + FS + "pkg" + FS + "B.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    89
            "<td class=\"colFirst\"><code>default void</code></td>"},
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    90
        {BUG_ID + FS + "pkg" + FS + "B.html",
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    91
            "<dl>" + NL + "<dt>Functional Interface:</dt>"}
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    92
    };
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    93
    private static final String[][] NEGATED_TEST_1 = {
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    94
        {BUG_ID + "-2" + FS + "pkg1" + FS + "FuncInf.html",
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    95
            "<dl>" + NL + "<dt>Functional Interface:</dt>"}
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    96
    };
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    97
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    98
    /**
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    99
     * The entry point of the test.
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   100
     * @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
   101
     */
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   102
    public static void main(String[] args) {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   103
        TestLambdaFeature tester = new TestLambdaFeature();
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   104
        run(tester, ARGS, TEST, NEGATED_TEST);
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
   105
        run(tester, 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
   106
        tester.printSummary();
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
    /**
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   110
     * {@inheritDoc}
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 String getBugId() {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   113
        return BUG_ID;
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   114
    }
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   115
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   116
    /**
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   117
     * {@inheritDoc}
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   118
     */
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   119
    public String getBugName() {
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   120
        return getClass().getName();
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   121
    }
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   122
}