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 8004832 27 * @summary Add new doclint package 28 * @modules jdk.compiler/com.sun.tools.doclint 29 * @build DocLintTester 30 * @run main DocLintTester -Xmsgs:all OverridesTest.java 31 */ 32 33 /* 34 * This is a test that missing comments on methods may be inherited 35 * from overridden methods. As such, there should be no errors due 36 * to missing comments (or any other types of error) in this test. 37 */ 38 39 /** An interface. */ 40 interface I1 { 41 /** 42 * A method 43 * @param p a param 44 * @throws Exception an exception 45 * @return an int 46 */ m(int p)47 int m(int p) throws Exception; 48 } 49 50 /** An extending interface. */ 51 interface I2 extends I1 { } 52 53 /** An abstract class. */ 54 abstract class C1 { 55 /** 56 * A method 57 * @param p a param 58 * @throws Exception an exception 59 * @return an int 60 */ m(int p)61 int m(int p) throws Exception; 62 } 63 64 /** An implementing class. */ 65 class C2 implements I1 { m(int p)66 int m(int p) throws Exception { return p; } 67 } 68 69 /** An extending class. */ 70 class C3 extends C1 { m(int p)71 int m(int p) throws Exception { return p; } 72 } 73 74 /** An extending and implementing class. */ 75 class C4 extends C1 implements I1 { m(int p)76 int m(int p) throws Exception { return p; } 77 } 78 79 /** An implementing class using inheritdoc. */ 80 class C5 implements I1 { 81 /** {@inheritDoc} */ m(int p)82 int m(int p) throws Exception { return p; } 83 } 84 85 /** An implementing class with incomplete documentation. */ 86 class C6 implements I1 { 87 /** Overriding method */ m(int p)88 int m(int p) throws Exception { return p; } 89 } 90 91 /** A class implementing an inherited interface. */ 92 class C7 implements I2 { m(int p)93 int m(int p) throws Exception { return p; } 94 } 95