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