Mon, 16 Sep 2013 14:13:44 +0200
8021112: Spurious unchecked warning reported by javac
6480588: No way to suppress deprecation warnings when implementing deprecated interface
Summary: Fixing DeferredLintHandler configuration, so lint warnings are reported with correct @SuppressWarnings settings
Reviewed-by: jjg, vromero
1 /*
2 * Copyright (c) 2013, 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 * @bug 8006124 8009684 8016921 8023700
27 * @summary Test javadoc support for profiles.
28 * @author Bhavesh Patel, Evgeniya Stepanova
29 * @library ../lib/
30 * @build JavadocTester TestProfiles
31 * @run main TestProfiles
32 */
33 public class TestProfiles extends JavadocTester {
35 //Test information.
36 private static final String BUG_ID = "8006124-8009684-8016921";
37 private static final String PROFILE_BUG_ID = BUG_ID + "-1";
38 private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
39 //Javadoc arguments.
40 private static final String[] ARGS1 = new String[]{
41 "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath",
42 SRC_DIR + FS + "profile-rtjar-includes.txt", "pkg1", "pkg2",
43 "pkg3", "pkg4", "pkg5", "pkgDeprecated"
44 };
45 private static final String[] ARGS2 = new String[]{
46 "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
47 };
48 //Input for string tests for profiles.
49 private static final String[][] PROFILES_TEST = {
50 // Tests for profile-overview-frame.html listing all profiles.
51 {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
52 "<span><a href=\"overview-frame.html\" "
53 + "target=\"packageListFrame\">All Packages</a></span>"
54 },
55 {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
56 "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">"
57 + "compact1</a></li>"
58 },
59 // Tests for profileName-frame.html listing all packages in a profile.
60 {PROFILE_BUG_ID + FS + "compact2-frame.html",
61 "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
62 + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
63 + "target=\"packageListFrame\">All Profiles</a></span>"
64 },
65 {PROFILE_BUG_ID + FS + "compact2-frame.html",
66 "<li><a href=\"pkg4/compact2-package-frame.html\" "
67 + "target=\"packageFrame\">pkg4</a></li>"
68 },
69 // Test for profileName-package-frame.html listing all types in a
70 // package of a profile.
71 {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
72 "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
73 + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
74 + "target=\"classFrame\">pkg2</a>"
75 },
76 // Tests for profileName-summary.html listing the summary for a profile.
77 {PROFILE_BUG_ID + FS + "compact2-summary.html",
78 "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
79 + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
80 },
81 {PROFILE_BUG_ID + FS + "compact2-summary.html",
82 "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>"
83 },
84 {PROFILE_BUG_ID + FS + "compact2-summary.html",
85 "<h3><a href=\"pkg2/compact2-package-summary.html\" "
86 + "target=\"classFrame\">pkg2</a></h3>"
87 },
88 // Tests for profileName-package-summary.html listing the summary for a
89 // package in a profile.
90 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
91 "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
92 + "</a></li>"
93 },
94 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
95 "<div class=\"subTitle\">compact3</div>"
96 },
97 //Test for "overview-frame.html" showing the "All Profiles" link.
98 {PROFILE_BUG_ID + FS + "overview-frame.html",
99 "<span><a href=\"profile-overview-frame.html\" "
100 + "target=\"packageListFrame\">All Profiles</a></span>"
101 },
102 //Test for "className.html" showing the profile information for the type.
103 {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
104 "<div class=\"subTitle\">compact1, compact2, compact3</div>"
105 },
106 {PROFILE_BUG_ID + FS + "index.html",
107 "<frame src=\"overview-frame.html\" name=\"packageListFrame\" " +
108 "title=\"All Packages\">"
109 },
110 //Test for "overview-summary.html" showing the profile list.
111 {PROFILE_BUG_ID + FS + "overview-summary.html",
112 "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
113 "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
114 "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
115 "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
116 "</ul>"
117 },
118 //Test deprecated class in profiles
119 {PROFILE_BUG_ID + FS + "compact1-summary.html","<td class=\"colFirst\">"
120 + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>"
121 + NL + "<td class=\"colLast\">Deprecated"
122 },
123 {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
124 + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>"
125 + NL +"<div class=\"block\"><span class=\"italic\">Class1Pkg2. This class is deprecated</span></div>"
126 },
127 //Test deprecated package in profile
128 {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
129 + "<a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>"
130 + NL +"<div class=\"block\"><span class=\"italic\">This package is <b>Deprecated</b>."
131 + " Use pkg1.</span></div>"
132 },
133 {PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html",
134 "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>"
135 + NL + "<div class=\"block\"><span class=\"italic\">This package is <b>Deprecated</b>."
136 + " Use pkg1.</span></div>"
137 },
138 // need to add teststring when JDK-8015496 will be fixed
139 //Test exception in profiles
140 {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"packageSummary\" "
141 + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
142 + "summary=\"Exception Summary table, listing exceptions, and an explanation\">"
143 + NL + "<caption><span>Exception Summary</span><span class=\"tabEnd\">"
144 + " </span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\" "
145 + "scope=\"col\">Exception</th>" + NL + "<th class=\"colLast\" scope=\"col\">"
146 + "Description</th>" + NL + "</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">"
147 + NL + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\""
148 + " title=\"class in pkg2\">ClassException</a></td>"
149 },
150 //Test errors in profiles
151 {PROFILE_BUG_ID + FS + "compact1-summary.html",
152 "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
153 + "summary=\"Error Summary table, listing errors, and an explanation\">"
154 + NL + "<caption><span>Error Summary</span><span class=\"tabEnd\"> "
155 + "</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\""
156 + " scope=\"col\">Error</th>" + NL + "<th class=\"colLast\" "
157 + "scope=\"col\">Description</th>" + NL + "</tr>" + NL + "<tbody>"
158 + NL + "<tr class=\"altColor\">" + NL + "<td class=\"colFirst\">"
159 + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>"
160 }
161 };
162 private static final String[][] PROFILES_NEGATED_TEST = {
163 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
164 "<div class=\"subTitle\">compact1"
165 },
166 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
167 "<div class=\"subTitle\">compact1"
168 },
169 {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
170 "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
171 + "target=\"classFrame\">Anno1Pkg4</a></li>"
172 },
173 {PROFILE_BUG_ID + FS + "compact1-summary.html","<li>Use</li>"
174 }
175 };
176 private static final String[][] PACKAGES_TEST = {
177 {PACKAGE_BUG_ID + FS + "overview-frame.html",
178 "<h2 title=\"Packages\">Packages</h2>"
179 },
180 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
181 "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
182 + "target=\"classFrame\">pkg4</a></h1>"
183 },
184 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
185 "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
186 + "class=\"title\">Package pkg4</h1>" + NL + "</div>"
187 }
188 };
189 private static final String[][] PACKAGES_NEGATED_TEST = {
190 {PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
191 "<span><a href=\"overview-frame.html\" "
192 + "target=\"packageListFrame\">All Packages</a></span>"
193 },
194 {PACKAGE_BUG_ID + FS + "compact2-frame.html",
195 "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
196 + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
197 + "target=\"packageListFrame\">All Profiles</a></span>"
198 },
199 {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
200 "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
201 + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
202 + "target=\"classFrame\">pkg2</a>"
203 },
204 {PACKAGE_BUG_ID + FS + "compact2-summary.html",
205 "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>"
206 },
207 {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
208 "<div class=\"subTitle\">compact3</div>"
209 },
210 {PACKAGE_BUG_ID + FS + "overview-frame.html",
211 "<span><a href=\"profile-overview-frame.html\" "
212 + "target=\"packageListFrame\">All Profiles</a></span>"
213 },
214 {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
215 "<div class=\"subTitle\">compact1, compact2, compact3</div>"
216 },
217 {PACKAGE_BUG_ID + FS + "overview-summary.html",
218 "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
219 "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
220 "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
221 "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
222 "</ul>"
223 }
224 };
226 /**
227 * The entry point of the test.
228 *
229 * @param args the array of command line arguments.
230 */
231 public static void main(String[] args) {
232 TestProfiles tester = new TestProfiles();
233 run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
234 run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST);
235 tester.printSummary();
236 }
238 /**
239 * {@inheritDoc}
240 */
241 public String getBugId() {
242 return BUG_ID;
243 }
245 /**
246 * {@inheritDoc}
247 */
248 public String getBugName() {
249 return getClass().getName();
250 }
251 }