1 /* 2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8004893 8022738 8029143 27 * @summary Make sure that the lambda feature changes work fine in 28 * javadoc. 29 * @author bpatel 30 * @library ../lib/ 31 * @modules jdk.javadoc 32 * @build JavadocTester TestLambdaFeature 33 * @run main TestLambdaFeature 34 */ 35 36 /* 37 * NOTE : This test should be elided when version 1.7 support is removed from the JDK 38 * or the negative part of the test showing 1.7's non-support should be 39 * removed [ 8022738 ] 40 */ 41 42 public class TestLambdaFeature extends JavadocTester { 43 44 public static void main(String... args) throws Exception { 45 TestLambdaFeature tester = new TestLambdaFeature(); 46 tester.runTests(); 47 } 48 49 @Test 50 void testDefault() { 51 javadoc("-d", "out-default", 52 "-sourcepath", testSrc, 53 "pkg", "pkg1"); 54 checkExit(Exit.OK); 55 56 checkOutput("pkg/A.html", true, 57 "<td class=\"colFirst\"><code>default void</code></td>", 58 "<pre>default void defaultMethod()</pre>", 59 "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" 60 + "All Methods</span><span class=\"tabEnd\"> </span></span>" 61 + "<span id=\"t2\" class=\"tableTab\"><span>" 62 + "<a href=\"javascript:show(2);\">Instance Methods</a></span>" 63 + "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " 64 + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" 65 + "Abstract Methods</a></span><span class=\"tabEnd\"> </span>" 66 + "</span><span id=\"t5\" class=\"tableTab\"><span>" 67 + "<a href=\"javascript:show(16);\">Default Methods</a></span>" 68 + "<span class=\"tabEnd\"> </span></span></caption>", 69 "<dl>\n" 70 + "<dt>Functional Interface:</dt>\n" 71 + "<dd>This is a functional interface and can therefore be used as " 72 + "the assignment target for a lambda expression or method " 73 + "reference.</dd>\n" 74 + "</dl>"); 75 76 checkOutput("pkg1/FuncInf.html", true, 77 "<dl>\n" 78 + "<dt>Functional Interface:</dt>\n" 79 + "<dd>This is a functional interface and can therefore be used as " 80 + "the assignment target for a lambda expression or method " 81 + "reference.</dd>\n" 82 + "</dl>"); 83 84 checkOutput("pkg/A.html", false, 85 "<td class=\"colFirst\"><code>default default void</code></td>", 86 "<pre>default default void defaultMethod()</pre>"); 87 88 checkOutput("pkg/B.html", false, 89 "<td class=\"colFirst\"><code>default void</code></td>", 90 "<dl>\n" 91 + "<dt>Functional Interface:</dt>"); 92 93 checkOutput("pkg1/NotAFuncInf.html", false, 94 "<dl>\n" 95 + "<dt>Functional Interface:</dt>\n" 96 + "<dd>This is a functional interface and can therefore be used as " 97 + "the assignment target for a lambda expression or method " 98 + "reference.</dd>\n" 99 + "</dl>"); 100 } 101 102 @Test 103 void testSource7() { 104 javadoc("-d", "out-7", 105 "-sourcepath", testSrc, 106 "-source", "1.7", 107 "pkg1"); 108 checkExit(Exit.OK); 109 110 checkOutput("pkg1/FuncInf.html", false, 111 "<dl>\n" 112 + "<dt>Functional Interface:</dt>"); 113 } 114 }