langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java
author jjg
Fri, 09 May 2014 15:37:12 -0700
changeset 24399 af1a0220d0fa
parent 24072 e7549dcbc4af
child 30730 d3ce7619db2c
permissions -rw-r--r--
8038730: Clean up the way JavadocTester is invoked, and checks for errors. Reviewed-by: ksrini, sogoel, bpatel
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
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
    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
    44
        TestLambdaFeature tester = new TestLambdaFeature();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
    void testDefault() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
        javadoc("-d", "out-default",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
                "pkg", "pkg1");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
        checkExit(Exit.OK);
19912
4b1a79163f9c 8022738: doclet should only generate functional interface text if source >= 8
bpatel
parents: 16319
diff changeset
    54
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
        checkOutput("pkg/A.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
                "<td class=\"colFirst\"><code>default void</code></td>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    57
                "<pre>default&nbsp;void&nbsp;defaultMethod()</pre>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    59
                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    60
                + "<span id=\"t2\" class=\"tableTab\"><span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    61
                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    62
                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    63
                + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    64
                + "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    65
                + "</span><span id=\"t5\" class=\"tableTab\"><span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    66
                + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    68
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    69
                + "<dt>Functional Interface:</dt>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    70
                + "<dd>This is a functional interface and can therefore be used as "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    71
                + "the assignment target for a lambda expression or method "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    72
                + "reference.</dd>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    73
                + "</dl>");
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    74
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
        checkOutput("pkg1/FuncInf.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    76
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
                + "<dt>Functional Interface:</dt>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    78
                + "<dd>This is a functional interface and can therefore be used as "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    79
                + "the assignment target for a lambda expression or method "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    80
                + "reference.</dd>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    81
                + "</dl>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    82
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    83
        checkOutput("pkg/A.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    84
                "<td class=\"colFirst\"><code>default default void</code></td>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    85
                "<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    86
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    87
        checkOutput("pkg/B.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    88
                "<td class=\"colFirst\"><code>default void</code></td>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    89
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    90
                + "<dt>Functional Interface:</dt>");
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
    91
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    92
        checkOutput("pkg1/NotAFuncInf.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    93
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    94
                + "<dt>Functional Interface:</dt>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    95
                + "<dd>This is a functional interface and can therefore be used as "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    96
                + "the assignment target for a lambda expression or method "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    97
                + "reference.</dd>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    98
                + "</dl>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    99
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   100
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   101
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   102
    void testSource7() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   103
        javadoc("-d", "out-7",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   104
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   105
                "-source", "1.7",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   106
                "pkg1");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   107
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   108
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   109
        checkOutput("pkg1/FuncInf.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   110
                "<dl>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   111
                + "<dt>Functional Interface:</dt>");
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   112
    }
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents:
diff changeset
   113
}