author | bpatel |
Fri, 27 Feb 2009 18:57:17 -0800 | |
changeset 2216 | b124d5c924eb |
parent 1787 | 1aa079321cd2 |
child 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2 |
* Copyright 2003-2004 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 |
* have any questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 4780441 4874845 4978816 |
|
27 |
* @summary Make sure that when the -private flag is not used, members |
|
28 |
* inherited from package private class are documented in the child. |
|
29 |
* |
|
30 |
* Make sure that when a method inherits documentation from a method |
|
31 |
* in a non-public class/interface, the non-public class/interface |
|
32 |
* is not mentioned anywhere (not even in the signature or tree). |
|
33 |
* |
|
34 |
* Make sure that when a private interface method with generic parameters |
|
35 |
* is implemented, the comments can be inherited properly. |
|
36 |
* @author jamieh |
|
37 |
* @library ../lib/ |
|
38 |
* @build JavadocTester |
|
39 |
* @build TestPrivateClasses |
|
40 |
* @run main TestPrivateClasses |
|
41 |
*/ |
|
42 |
||
43 |
public class TestPrivateClasses extends JavadocTester { |
|
44 |
||
45 |
//Test information. |
|
46 |
private static final String BUG_ID = "4780441-4874845-4978816"; |
|
47 |
||
48 |
//Javadoc arguments. |
|
49 |
private static final String[] ARGS1 = new String[] { |
|
50 |
"-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-source", "1.5", "pkg", "pkg2" |
|
51 |
}; |
|
52 |
private static final String[] ARGS2 = new String[] { |
|
53 |
"-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-private", |
|
54 |
"-source", "1.5", "pkg", "pkg2" |
|
55 |
}; |
|
56 |
||
57 |
// Test output when -private flag is not used. |
|
58 |
private static final String[][] TEST1 = { |
|
59 |
// Field inheritence from non-public superclass. |
|
60 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
61 |
"<A HREF=\"../pkg/PublicChild.html#fieldInheritedFromParent\">" + |
|
62 |
"fieldInheritedFromParent</A>" |
|
63 |
}, |
|
64 |
||
65 |
// Method inheritence from non-public superclass. |
|
66 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
67 |
"<A HREF=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" + |
|
68 |
"methodInheritedFromParent</A>" |
|
69 |
}, |
|
70 |
||
71 |
// Field inheritence from non-public superinterface. |
|
72 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
|
73 |
"<A HREF=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">" + |
|
74 |
"fieldInheritedFromInterface</A>" |
|
75 |
}, |
|
76 |
||
77 |
// Method inheritence from non-public superinterface. |
|
78 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
|
79 |
"<A HREF=\"../pkg/PublicInterface.html#methodInterface(int)\">" + |
|
80 |
"methodInterface</A>" |
|
81 |
}, |
|
82 |
||
83 |
// private class does not show up in tree |
|
84 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
85 |
"<PRE>" + NL + |
|
86 |
"java.lang.Object" + NL + |
|
87 |
" <IMG SRC=\"../resources/inherit.gif\" " + |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
88 |
"ALT=\"extended by \"><STRONG>pkg.PublicChild</STRONG>" + NL + |
10 | 89 |
"</PRE>" |
90 |
}, |
|
91 |
||
92 |
// Method is documented as though it is declared in the inheriting method. |
|
93 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
94 |
"public void <STRONG>methodInheritedFromParent</STRONG>(int p1)" |
10 | 95 |
}, |
96 |
||
97 |
//Make sure implemented interfaces from private superclass are inherited |
|
98 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
99 |
"<STRONG>All Known Implementing Classes:</STRONG></DT> <DD><A HREF=\"../pkg/PublicChild.html\" " + |
10 | 100 |
"title=\"class in pkg\">PublicChild</A>"}, |
101 |
||
102 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
103 |
"<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/PublicInterface.html\" " + |
10 | 104 |
"title=\"interface in pkg\">PublicInterface</A>"}, |
105 |
||
106 |
//Generic interface method test. |
|
107 |
{BUG_ID + "-1" + FS + "pkg2" + FS + "C.html", |
|
108 |
"This comment should get copied to the implementing class"}, |
|
109 |
}; |
|
110 |
private static final String[][] NEGATED_TEST1 = { |
|
111 |
// Should not document that a method overrides method from private class. |
|
112 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
113 |
"<STRONG>Overrides:</STRONG>"}, |
10 | 114 |
// Should not document that a method specified by private interface. |
115 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
116 |
"<STRONG>Specified by:</STRONG>"}, |
10 | 117 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
118 |
"<STRONG>Specified by:</STRONG>"}, |
10 | 119 |
// Should not mention that any documentation was copied. |
120 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
121 |
"Description copied from"}, |
|
122 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
|
123 |
"Description copied from"}, |
|
124 |
// Don't extend private classes or interfaces |
|
125 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
126 |
"PrivateParent"}, |
|
127 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
|
128 |
"PrivateInterface"}, |
|
129 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", |
|
130 |
"PrivateInterface"}, |
|
131 |
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", |
|
132 |
"All Superinterfaces"}, |
|
133 |
// Make inherited constant are documented correctly. |
|
134 |
{BUG_ID + "-1" + FS + "constant-values.html", |
|
135 |
"PrivateInterface"}, |
|
136 |
||
137 |
//Do not inherit private interface method with generic parameters. |
|
138 |
//This method has been implemented. |
|
139 |
{BUG_ID + "-1" + FS + "pkg2" + FS + "C.html", |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
140 |
"<STRONG><A HREF=\"../pkg2/I.html#hello(T)\">hello</A></STRONG>"}, |
10 | 141 |
}; |
142 |
||
143 |
// Test output when -private flag is used. |
|
144 |
private static final String[][] TEST2 = { |
|
145 |
// Field inheritence from non-public superclass. |
|
146 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
147 |
"Fields inherited from class " + |
|
148 |
"pkg.<A HREF=\"../pkg/PrivateParent.html\" " + |
|
149 |
"title=\"class in pkg\">PrivateParent</A>" |
|
150 |
}, |
|
151 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
152 |
"<A HREF=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">" + |
|
153 |
"fieldInheritedFromParent</A>" |
|
154 |
}, |
|
155 |
// Field inheritence from non-public superinterface. |
|
156 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", |
|
157 |
"Fields inherited from interface " + |
|
158 |
"pkg.<A HREF=\"../pkg/PrivateInterface.html\" " + |
|
159 |
"title=\"interface in pkg\">PrivateInterface</A>" |
|
160 |
}, |
|
161 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", |
|
162 |
"<A HREF=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">" + |
|
163 |
"fieldInheritedFromInterface</A>" |
|
164 |
}, |
|
165 |
// Method inheritence from non-public superclass. |
|
166 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
167 |
"Methods inherited from class " + |
|
168 |
"pkg.<A HREF=\"../pkg/PrivateParent.html\" " + |
|
169 |
"title=\"class in pkg\">PrivateParent</A>" |
|
170 |
}, |
|
171 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
172 |
"<A HREF=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" + |
|
173 |
"methodInheritedFromParent</A>" |
|
174 |
}, |
|
175 |
// Should document that a method overrides method from private class. |
|
176 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
177 |
"<STRONG>Overrides:</STRONG></DT><DD><CODE>" + |
10 | 178 |
"<A HREF=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" + |
179 |
"methodOverridenFromParent</A></CODE> in class <CODE>" + |
|
180 |
"<A HREF=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" + |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
181 |
"PrivateParent</A></CODE></DD>" + NL + "</DL>"}, |
10 | 182 |
// Should document that a method is specified by private interface. |
183 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
184 |
"<STRONG>Specified by:</STRONG></DT><DD><CODE>" + |
10 | 185 |
"<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" + |
186 |
"methodInterface</A></CODE> in interface <CODE>" + |
|
187 |
"<A HREF=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" + |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
188 |
"PrivateInterface</A></CODE></DD>" + NL + "</DL>" + NL + "</DD>"}, |
10 | 189 |
// Method inheritence from non-public superinterface. |
190 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", |
|
191 |
"Methods inherited from interface " + |
|
192 |
"pkg.<A HREF=\"../pkg/PrivateInterface.html\" " + |
|
193 |
"title=\"interface in pkg\">PrivateInterface</A>" |
|
194 |
}, |
|
195 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html", |
|
196 |
"<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" + |
|
197 |
"methodInterface</A>" |
|
198 |
}, |
|
199 |
// Should mention that any documentation was copied. |
|
200 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
201 |
"Description copied from"}, |
|
202 |
// Extend documented private classes or interfaces |
|
203 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
204 |
"extends"}, |
|
205 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", |
|
206 |
"extends"}, |
|
207 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", |
|
208 |
"All Superinterfaces"}, |
|
209 |
||
210 |
//Make sure implemented interfaces from private superclass are inherited |
|
211 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
212 |
"<STRONG>All Known Implementing Classes:</STRONG></DT> <DD><A HREF=\"../pkg/PrivateParent.html\" " + |
10 | 213 |
"title=\"class in pkg\">PrivateParent</A>, " + |
214 |
"<A HREF=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</A>"}, |
|
215 |
||
216 |
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
217 |
"<STRONG>All Implemented Interfaces:</STRONG></DT> <DD><A HREF=\"../pkg/PrivateInterface.html\" " + |
10 | 218 |
"title=\"interface in pkg\">PrivateInterface</A>, " + |
219 |
"<A HREF=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" + |
|
220 |
"PublicInterface</A>"}, |
|
221 |
||
222 |
//Since private flag is used, we can document that private interface method |
|
223 |
//with generic parameters has been implemented. |
|
224 |
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
225 |
"<STRONG>Description copied from interface: " + |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
226 |
"<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></STRONG>"}, |
10 | 227 |
|
228 |
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
229 |
"<STRONG>Specified by:</STRONG></DT><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" + |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
230 |
"hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " + |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
231 |
"title=\"interface in pkg2\">I</A>"}, |
10 | 232 |
}; |
233 |
private static final String[][] NEGATED_TEST2 = NO_TEST; |
|
234 |
||
235 |
/** |
|
236 |
* The entry point of the test. |
|
237 |
* @param args the array of command line arguments. |
|
238 |
*/ |
|
239 |
public static void main(String[] args) { |
|
240 |
TestPrivateClasses tester = new TestPrivateClasses(); |
|
241 |
run(tester, ARGS1, TEST1, NEGATED_TEST1); |
|
242 |
run(tester, ARGS2, TEST2, NEGATED_TEST2); |
|
243 |
tester.printSummary(); |
|
244 |
} |
|
245 |
||
246 |
/** |
|
247 |
* {@inheritDoc} |
|
248 |
*/ |
|
249 |
public String getBugId() { |
|
250 |
return BUG_ID; |
|
251 |
} |
|
252 |
||
253 |
/** |
|
254 |
* {@inheritDoc} |
|
255 |
*/ |
|
256 |
public String getBugName() { |
|
257 |
return getClass().getName(); |
|
258 |
} |
|
259 |
} |