1 /* 2 * Copyright (c) 2012, 2018, 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 8175200 8186332 8184205 27 * @summary Make sure that the lambda feature changes work fine in 28 * javadoc. 29 * @author bpatel 30 * @library ../../lib/ 31 * @modules jdk.javadoc/jdk.javadoc.internal.tool 32 * @build javadoc.tester.* 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 import javadoc.tester.JavadocTester; 43 44 public class TestLambdaFeature extends JavadocTester { 45 46 public static void main(String... args) throws Exception { 47 TestLambdaFeature tester = new TestLambdaFeature(); 48 tester.runTests(); 49 } 50 51 @Test 52 public void testDefault() { 53 javadoc("-d", "out-default", 54 "-sourcepath", testSrc, 55 "pkg", "pkg1"); 56 checkExit(Exit.OK); 57 58 checkOutput("pkg/A.html", true, 59 "<td class=\"colFirst\"><code>default void</code></td>", 60 "<pre>default void defaultMethod()</pre>", 61 "<div role=\"tablist\" aria-orientation=\"horizontal\"><button role=\"tab\"" 62 + " aria-selected=\"true\" aria-controls=\"memberSummary_tabpanel\" tabindex=\"0\"" 63 + " onkeydown=\"switchTab(event)\" id=\"t0\" class=\"activeTableTab\">All Methods" 64 + "</button><button role=\"tab\" aria-selected=\"false\"" 65 + " aria-controls=\"memberSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\"" 66 + " id=\"t2\" class=\"tableTab\" onclick=\"show(2);\">Instance Methods</button>" 67 + "<button role=\"tab\" aria-selected=\"false\" aria-controls=\"memberSummary_tabpanel\"" 68 + " tabindex=\"-1\" onkeydown=\"switchTab(event)\" id=\"t3\" class=\"tableTab\"" 69 + " onclick=\"show(4);\">Abstract Methods</button><button role=\"tab\" aria-selected=\"false\"" 70 + " aria-controls=\"memberSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\"" 71 + " id=\"t5\" class=\"tableTab\" onclick=\"show(16);\">Default Methods</button></div>", 72 "<dl>\n" 73 + "<dt>Functional Interface:</dt>\n" 74 + "<dd>This is a functional interface and can therefore be used as " 75 + "the assignment target for a lambda expression or method " 76 + "reference.</dd>\n" 77 + "</dl>"); 78 79 checkOutput("pkg1/FuncInf.html", true, 80 "<dl>\n" 81 + "<dt>Functional Interface:</dt>\n" 82 + "<dd>This is a functional interface and can therefore be used as " 83 + "the assignment target for a lambda expression or method " 84 + "reference.</dd>\n" 85 + "</dl>"); 86 87 checkOutput("pkg/A.html", false, 88 "<td class=\"colFirst\"><code>default default void</code></td>", 89 "<pre>default default void defaultMethod()</pre>"); 90 91 checkOutput("pkg/B.html", false, 92 "<td class=\"colFirst\"><code>default void</code></td>", 93 "<dl>\n" 94 + "<dt>Functional Interface:</dt>"); 95 96 checkOutput("pkg1/NotAFuncInf.html", false, 97 "<dl>\n" 98 + "<dt>Functional Interface:</dt>\n" 99 + "<dd>This is a functional interface and can therefore be used as " 100 + "the assignment target for a lambda expression or method " 101 + "reference.</dd>\n" 102 + "</dl>"); 103 } 104 105 @Test 106 public void testSource7() { 107 javadoc("-d", "out-7", 108 "-sourcepath", testSrc, 109 "-source", "1.7", 110 "pkg1"); 111 checkExit(Exit.OK); 112 113 checkOutput("pkg1/FuncInf.html", false, 114 "<dl>\n" 115 + "<dt>Functional Interface:</dt>"); 116 } 117 }