test/tools/doclint/OverridesTest.java

Mon, 17 Dec 2012 07:47:05 -0800

author
jjg
date
Mon, 17 Dec 2012 07:47:05 -0800
changeset 1455
75ab654b5cd5
child 1465
a22f23fb7abf
permissions
-rw-r--r--

8004832: Add new doclint package
Reviewed-by: mcimadamore

     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  */
    24 /*
    25  * @test
    26  * @build DocLintTester
    27  * @run main DocLintTester -Xmsgs:all OverridesTest.java
    28  */
    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  */
    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 }
    47 /** An extending interface. */
    48 interface I2 extends I1 { }
    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 }
    61 /** An implementing class. */
    62 class C2 implements I1 {
    63     int m(int  p) throws Exception { return p; }
    64 }
    66 /** An extending class. */
    67 class C3 extends C1 {
    68     int m(int  p) throws Exception { return p; }
    69 }
    71 /** An extending and implementing class. */
    72 class C4 extends C1 implements I1 {
    73     int m(int  p) throws Exception { return p; }
    74 }
    76 /** An implementing class using inheritdoc. */
    77 class C5 implements I1 {
    78     /** {@inheritDoc} */
    79     int m(int  p) throws Exception { return p; }
    80 }
    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 }
    88 /** A class implementing an inherited interface. */
    89 class C7 implements I2 {
    90     int m(int  p) throws Exception { return p; }
    91 }

mercurial