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