1 /* 2 * Copyright (c) 2002, 2016, 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 4684827 4633969 27 * @summary This test verifies that throws tags in implementing class 28 * override the throws tags in interface. This test also verifies that throws tags are inherited properly 29 * the case where the name of one exception is not fully qualified. 30 * @author jamieh 31 * @library ../lib 32 * @modules jdk.javadoc 33 * @build JavadocTester 34 * @run main TestThrowsTagInheritence 35 */ 36 37 // TODO: should be TestThrowsInheritance! 38 public class TestThrowsTagInheritence extends JavadocTester { 39 40 public static void main(String... args) throws Exception { 41 TestThrowsTagInheritence tester = new TestThrowsTagInheritence(); 42 tester.runTests(); 43 } 44 45 @Test 46 void test() { 47 javadoc("-d", "out", 48 "-sourcepath", testSrc, 49 testSrc("C.java"), 50 testSrc("I.java"), 51 testSrc("Foo.java"), 52 testSrc("Iface.java")); 53 checkExit(Exit.OK); 54 55 // The class should not inherit the tag from the interface. 56 checkOutput("Foo.html", true, 57 "Test 1 passes."); 58 59 //The class should not inherit the tag from the interface. 60 checkOutput("C.html", false, 61 "Test 1 fails."); 62 } 63 64 @Test 65 void test1() { 66 javadoc("-d", "out-1", 67 "-sourcepath", testSrc, 68 "-package", "pkg"); 69 checkExit(Exit.OK); 70 71 // The method should not inherit the IOOBE throws tag from the abstract class, 72 // for now keep keep this bug compatible, should fix this correctly in 73 // the future. 74 checkOutput("pkg/Extender.html", false, "java.lang.IndexOutOfBoundsException"); 75 } 76 }