File: TestDeprecatedDocs.java

package info (click to toggle)
openjdk-11 11.0.24%2B8-2~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 780,008 kB
  • sloc: java: 5,197,087; xml: 1,192,267; cpp: 1,138,204; ansic: 462,088; javascript: 162,551; sh: 16,713; objc: 13,719; python: 4,757; asm: 3,570; makefile: 2,943; perl: 357; awk: 351; sed: 172; jsp: 24; csh: 3
file content (384 lines) | stat: -rw-r--r-- 21,942 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/*
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/*
 * @test
 * @bug      4927552 8026567 8071982 8162674 8175200 8175218 8183511 8186332
 *           8169819 8074407 8191030 8182765
 * @summary  test generated docs for deprecated items
 * @author   jamieh
 * @library  ../lib
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
 * @build    JavadocTester
 * @run main TestDeprecatedDocs
 */

public class TestDeprecatedDocs extends JavadocTester {

    public static void main(String... args) throws Exception {
        TestDeprecatedDocs tester = new TestDeprecatedDocs();
        tester.runTests();
    }

    @Test
    void test() {
        javadoc("-d", "out",
                "-sourcepath", testSrc,
                "pkg");
        checkExit(Exit.OK);

        checkOutput("deprecated-list.html", true,
                "annotation_test1 passes",
                "annotation_test2 passes",
                "annotation_test3 passes",
                "annotation_test4 passes.",
                "class_test1 passes",
                "class_test2 passes",
                "class_test3 passes",
                "class_test4 passes",
                "enum_test1 passes",
                "enum_test2 passes",
                "error_test1 passes",
                "error_test2 passes",
                "error_test3 passes",
                "error_test4 passes",
                "exception_test1 passes",
                "exception_test2 passes",
                "exception_test3 passes",
                "exception_test4 passes",
                "interface_test1 passes",
                "interface_test2 passes",
                "interface_test3 passes",
                "interface_test4 passes",
                "pkg.DeprecatedClassByAnnotation",
                "pkg.DeprecatedClassByAnnotation()",
                "pkg.DeprecatedClassByAnnotation.method()",
                "pkg.DeprecatedClassByAnnotation.field"
        );

        checkOutput("pkg/DeprecatedClassByAnnotation.html", true,
                "<pre>@Deprecated\n"
                + "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n"
                + "extends java.lang.Object</pre>",
                "<pre>@Deprecated(forRemoval=true)\n"
                + "public&nbsp;int field</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span></div>",
                "<pre>@Deprecated(forRemoval=true)\n"
                + "public&nbsp;DeprecatedClassByAnnotation()</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span></div>",
                "<pre class=\"methodSignature\">@Deprecated\n"
                + "public&nbsp;void&nbsp;method()</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>");

        checkOutput("pkg/TestAnnotationType.html", true,
                "<hr>\n"
                + "<pre>@Deprecated(forRemoval=true)\n"
                + "@Documented\n"
                + "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">annotation_test1 passes.</div>\n"
                + "</div>",
                "<pre>@Deprecated(forRemoval=true)\n"
                + "static final&nbsp;int&nbsp;field</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
                + "API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">annotation_test4 passes.</div>\n"
                + "</div>",
                "<pre>@Deprecated(forRemoval=true)\n"
                + "int&nbsp;required</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">annotation_test3 passes.</div>\n"
                + "</div>",
                "<pre>java.lang.String&nbsp;optional</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
                + "<div class=\"deprecationComment\">annotation_test2 passes.</div>\n"
                + "</div>");

        checkOutput("pkg/TestClass.html", true,
                "<hr>\n"
                + "<pre>@Deprecated(forRemoval=true)\n"
                + "public class <span class=\"typeNameLabel\">TestClass</span>\n"
                + "extends java.lang.Object</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">class_test1 passes.</div>\n"
                + "</div>",
                "<pre>@Deprecated(forRemoval=true)\n"
                + "public&nbsp;TestClass()</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">class_test3 passes. This is the second sentence of deprecated description for a constructor.</div>\n"
                + "</div>",
                "<td class=\"colLast\">\n"
                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
                + "<div class=\"deprecationComment\">class_test2 passes.</div>\n"
                + "</div>\n"
                + "</td>",
                "<td class=\"colLast\">\n"
                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">class_test3 passes.</div>\n"
                + "</div>\n"
                + "</td>",
                "<td class=\"colLast\">\n"
                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
                + "<div class=\"deprecationComment\">class_test4 passes.</div>\n"
                + "</div>\n"
                + "</td>");

        checkOutput("pkg/TestClass.html", false,
                "<div class=\"deprecationComment\">class_test2 passes. This is the second sentence of deprecated description for a field.</div>\n"
                + "</div>\n"
                + "</td>",
                "<div class=\"deprecationComment\">class_test3 passes. This is the second sentence of deprecated description for a constructor.</div>\n"
                + "</div>\n"
                + "</td>",
                "<div class=\"deprecationComment\">class_test4 passes. This is the second sentence of deprecated description for a method.</div>\n"
                + "</div>\n"
                + "</td>");

        checkOutput("pkg/TestEnum.html", true,
                "<hr>\n"
                + "<pre>@Deprecated(forRemoval=true)\n"
                + "public enum <span class=\"typeNameLabel\">TestEnum</span>\n"
                + "extends java.lang.Enum&lt;<a href=\"TestEnum.html\" title=\"enum in pkg\">TestEnum</a>&gt;</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">enum_test1 passes.</div>\n"
                + "</div>",
                "<pre>@Deprecated(forRemoval=true)\n"
                + "public static final&nbsp;<a href=\"TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">enum_test3 passes.</div>\n"
                + "</div>");

        checkOutput("pkg/TestError.html", true,
                "<hr>\n"
                + "<pre>@Deprecated(forRemoval=true)\n"
                + "public class <span class=\"typeNameLabel\">TestError</span>\n"
                + "extends java.lang.Error</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">error_test1 passes.</div>\n"
                + "</div>");

        checkOutput("pkg/TestException.html", true,
                "<hr>\n"
                + "<pre>@Deprecated(forRemoval=true)\n"
                + "public class <span class=\"typeNameLabel\">TestException</span>\n"
                + "extends java.lang.Exception</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">exception_test1 passes.</div>\n"
                + "</div>");

        checkOutput("pkg/TestInterface.html", true,
                "<hr>\n"
                + "<pre>@Deprecated(forRemoval=true)\n"
                + "public class <span class=\"typeNameLabel\">TestInterface</span>\n"
                + "extends java.lang.Object</pre>\n"
                + "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span>\n"
                + "<div class=\"deprecationComment\">interface_test1 passes.</div>\n"
                + "</div>");

        checkOutput("deprecated-list.html", true,
                "<ul>\n"
                + "<li><a href=\"#forRemoval\">For Removal</a></li>\n"
                + "<li><a href=\"#class\">Classes</a></li>\n"
                + "<li><a href=\"#enum\">Enums</a></li>\n"
                + "<li><a href=\"#exception\">Exceptions</a></li>\n"
                + "<li><a href=\"#error\">Errors</a></li>\n"
                + "<li><a href=\"#annotation.type\">Annotation Types</a></li>\n"
                + "<li><a href=\"#field\">Fields</a></li>\n"
                + "<li><a href=\"#method\">Methods</a></li>\n"
                + "<li><a href=\"#constructor\">Constructors</a></li>\n"
                + "<li><a href=\"#enum.constant\">Enum Constants</a></li>\n"
                + "<li><a href=\"#annotation.type.member\">Annotation Type Elements</a></li>\n"
                + "</ul>",
                "<a id=\"forRemoval\">",
                "<table class=\"deprecatedSummary\">\n"
                + "<caption><span>For Removal</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Element</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>",
                "<table class=\"deprecatedSummary\">\n"
                + "<caption><span>Enums</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Enum</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>\n"
                + "<tbody>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">enum_test1 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "</tbody>\n"
                + "</table>",
                "<table class=\"deprecatedSummary\">\n"
                + "<caption><span>Exceptions</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Exceptions</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>\n"
                + "<tbody>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">exception_test1 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "</tbody>\n"
                + "</table>",
                "<table class=\"deprecatedSummary\">\n"
                + "<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Field</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>\n"
                + "<tbody>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/DeprecatedClassByAnnotation.html#field\">pkg.DeprecatedClassByAnnotation.field</a></th>\n"
                + "<td class=\"colLast\"></td>\n"
                + "</tr>\n"
                + "<tr class=\"rowColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestAnnotationType.html#field\">pkg.TestAnnotationType.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">annotation_test4 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestClass.html#field\">pkg.TestClass.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">class_test2 passes. This is the second sentence of deprecated description for a field.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"rowColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestError.html#field\">pkg.TestError.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">error_test2 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html#field\">pkg.TestException.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">exception_test2 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"rowColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestInterface.html#field\">pkg.TestInterface.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">interface_test2 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "</tbody>\n"
                + "</table>");
    }

    @Test
    void test_html4() {
        javadoc("-d", "out-html4",
                "-html4",
                "-sourcepath", testSrc,
                "pkg");
        checkExit(Exit.OK);

        checkOutput("deprecated-list.html", true,
                "<a name=\"forRemoval\">",
                "<table class=\"deprecatedSummary\" summary=\"For Removal table, listing for removal, and an explanation\">\n"
                + "<caption><span>For Removal</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Element</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>",
                "<table class=\"deprecatedSummary\" summary=\"Enums table, listing enums, and an explanation\">\n"
                + "<caption><span>Enums</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Enum</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>\n"
                + "<tbody>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">enum_test1 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "</tbody>\n"
                + "</table>",
                "<table class=\"deprecatedSummary\" summary=\"Exceptions table, listing exceptions, and an explanation\">\n"
                + "<caption><span>Exceptions</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Exceptions</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>\n"
                + "<tbody>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">exception_test1 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "</tbody>\n"
                + "</table>",
                "<table class=\"deprecatedSummary\" summary=\"Fields table, listing fields, and an explanation\">\n"
                + "<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
                + "<tr>\n"
                + "<th class=\"colFirst\" scope=\"col\">Field</th>\n"
                + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
                + "</tr>\n"
                + "<tbody>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/DeprecatedClassByAnnotation.html#field\">pkg.DeprecatedClassByAnnotation.field</a></th>\n"
                + "<td class=\"colLast\"></td>\n"
                + "</tr>\n"
                + "<tr class=\"rowColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestAnnotationType.html#field\">pkg.TestAnnotationType.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">annotation_test4 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestClass.html#field\">pkg.TestClass.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">class_test2 passes. This is the second sentence of deprecated description for a field.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"rowColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestError.html#field\">pkg.TestError.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">error_test2 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"altColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestException.html#field\">pkg.TestException.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">exception_test2 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "<tr class=\"rowColor\">\n"
                + "<th class=\"colDeprecatedItemName\" scope=\"row\"><a href=\"pkg/TestInterface.html#field\">pkg.TestInterface.field</a></th>\n"
                + "<td class=\"colLast\">\n"
                + "<div class=\"deprecationComment\">interface_test2 passes.</div>\n"
                + "</td>\n"
                + "</tr>\n"
                + "</tbody>\n"
                + "</table>");
    }
}