1/* 2 * Copyright (c) 2003, 2017, 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 4927552 8026567 8071982 8162674 8175200 8175218 27 * @summary <DESC> 28 * @author jamieh 29 * @library ../lib 30 * @modules jdk.javadoc/jdk.javadoc.internal.tool 31 * @build JavadocTester 32 * @run main TestDeprecatedDocs 33 */ 34 35public class TestDeprecatedDocs extends JavadocTester { 36 37 public static void main(String... args) throws Exception { 38 TestDeprecatedDocs tester = new TestDeprecatedDocs(); 39 tester.runTests(); 40 } 41 42 @Test 43 void test() { 44 javadoc("-d", "out", 45 "-sourcepath", testSrc, 46 "pkg"); 47 checkExit(Exit.OK); 48 49 checkOutput("deprecated-list.html", true, 50 "annotation_test1 passes", 51 "annotation_test2 passes", 52 "annotation_test3 passes", 53 "annotation_test4 passes.", 54 "class_test1 passes", 55 "class_test2 passes", 56 "class_test3 passes", 57 "class_test4 passes", 58 "enum_test1 passes", 59 "enum_test2 passes", 60 "error_test1 passes", 61 "error_test2 passes", 62 "error_test3 passes", 63 "error_test4 passes", 64 "exception_test1 passes", 65 "exception_test2 passes", 66 "exception_test3 passes", 67 "exception_test4 passes", 68 "interface_test1 passes", 69 "interface_test2 passes", 70 "interface_test3 passes", 71 "interface_test4 passes", 72 "pkg.DeprecatedClassByAnnotation", 73 "pkg.DeprecatedClassByAnnotation()", 74 "pkg.DeprecatedClassByAnnotation.method()", 75 "pkg.DeprecatedClassByAnnotation.field" 76 ); 77 78 checkOutput("pkg/DeprecatedClassByAnnotation.html", true, 79 "<pre>@Deprecated\n" 80 + "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n" 81 + "extends java.lang.Object</pre>", 82 "<pre>@Deprecated(forRemoval=true)\n" 83 + "public int field</pre>\n" 84 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>", 85 "<pre>@Deprecated(forRemoval=true)\n" 86 + "public DeprecatedClassByAnnotation​()</pre>\n" 87 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>", 88 "<pre>@Deprecated\n" 89 + "public void method​()</pre>\n" 90 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"); 91 92 checkOutput("pkg/TestAnnotationType.html", true, 93 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" 94 + "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n" 95 + "</div>\n" 96 + "<br>\n" 97 + "<pre>@Deprecated(forRemoval=true)\n" 98 + "@Documented\n" 99 + "public @interface <span class=\"memberNameLabel\">TestAnnotationType</span></pre>", 100 "<pre>@Deprecated(forRemoval=true)\n" 101 + "static final int field</pre>\n" 102 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This " 103 + "API element is subject to removal in a future version.</span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>", 104 "<pre>@Deprecated(forRemoval=true)\n" 105 + "int required</pre>\n" 106 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " 107 + "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>", 108 "<pre>java.lang.String optional</pre>\n" 109 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>"); 110 111 checkOutput("pkg/TestClass.html", true, 112 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" 113 + "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n" 114 + "</div>\n" 115 + "<br>\n" 116 + "<pre>@Deprecated(forRemoval=true)\n" 117 + "public class <span class=\"typeNameLabel\">TestClass</span>\n" 118 + "extends java.lang.Object</pre>", 119 "<pre>@Deprecated(forRemoval=true)\n" 120 + "public TestClass​()</pre>\n" 121 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " 122 + "<span class=\"deprecationComment\">class_test3 passes.</span></div>"); 123 124 checkOutput("pkg/TestEnum.html", true, 125 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" 126 + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n" 127 + "</div>\n" 128 + "<br>\n" 129 + "<pre>@Deprecated(forRemoval=true)\n" 130 + "public enum <span class=\"typeNameLabel\">TestEnum</span>\n" 131 + "extends java.lang.Enum<<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>></pre>", 132 "<pre>@Deprecated(forRemoval=true)\n" 133 + "public static final <a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n" 134 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> " 135 + "<span class=\"deprecationComment\">enum_test3 passes.</span></div>"); 136 137 checkOutput("pkg/TestError.html", true, 138 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" 139 + "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n" 140 + "</div>\n" 141 + "<br>\n" 142 + "<pre>@Deprecated(forRemoval=true)\n" 143 + "public class <span class=\"typeNameLabel\">TestError</span>\n" 144 + "extends java.lang.Error</pre>"); 145 146 checkOutput("pkg/TestException.html", true, 147 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" 148 + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n" 149 + "</div>\n" 150 + "<br>\n" 151 + "<pre>@Deprecated(forRemoval=true)\n" 152 + "public class <span class=\"typeNameLabel\">TestException</span>\n" 153 + "extends java.lang.Exception</pre>"); 154 155 checkOutput("pkg/TestInterface.html", true, 156 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n" 157 + "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n" 158 + "</div>\n" 159 + "<br>\n" 160 + "<pre>@Deprecated(forRemoval=true)\n" 161 + "public class <span class=\"typeNameLabel\">TestInterface</span>\n" 162 + "extends java.lang.Object</pre>"); 163 164 checkOutput("deprecated-list.html", true, 165 "<ul>\n" 166 + "<li><a href=\"#forRemoval\">Deprecated For Removal</a></li>\n" 167 + "<li><a href=\"#class\">Deprecated Classes</a></li>\n" 168 + "<li><a href=\"#enum\">Deprecated Enums</a></li>\n" 169 + "<li><a href=\"#exception\">Deprecated Exceptions</a></li>\n" 170 + "<li><a href=\"#error\">Deprecated Errors</a></li>\n" 171 + "<li><a href=\"#annotation.type\">Deprecated Annotation Types</a></li>\n" 172 + "<li><a href=\"#field\">Deprecated Fields</a></li>\n" 173 + "<li><a href=\"#method\">Deprecated Methods</a></li>\n" 174 + "<li><a href=\"#constructor\">Deprecated Constructors</a></li>\n" 175 + "<li><a href=\"#enum.constant\">Deprecated Enum Constants</a></li>\n" 176 + "<li><a href=\"#annotation.type.member\">Deprecated Annotation Type Elements</a></li>\n" 177 + "</ul>", 178 "<a name=\"forRemoval\">", 179 "<table class=\"deprecatedSummary\" summary=\"Deprecated For Removal table, listing deprecated for removal, and an explanation\">\n" 180 + "<caption><span>Deprecated For Removal</span><span class=\"tabEnd\"> </span></caption>\n" 181 + "<tr>\n" 182 + "<th class=\"colFirst\" scope=\"col\">Element</th>\n" 183 + "<th class=\"colLast\" scope=\"col\">Description</th>\n" 184 + "</tr>", 185 "<table class=\"deprecatedSummary\" summary=\"Deprecated Enums table, listing deprecated enums, and an explanation\">\n" 186 + "<caption><span>Deprecated Enums</span><span class=\"tabEnd\"> </span></caption>\n" 187 + "<tr>\n" 188 + "<th class=\"colFirst\" scope=\"col\">Enum</th>\n" 189 + "<th class=\"colLast\" scope=\"col\">Description</th>\n" 190 + "</tr>\n" 191 + "<tbody>\n" 192 + "<tr class=\"altColor\">\n" 193 + "<th class=\"colFirst\" scope=\"row\"><a href=\"pkg/TestEnum.html\" title=\"enum in pkg\">pkg.TestEnum</a></th>\n" 194 + "<td class=\"colLast\">\n" 195 + "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n" 196 + "</td>\n" 197 + "</tr>\n" 198 + "</tbody>\n" 199 + "</table>", 200 "<table class=\"deprecatedSummary\" summary=\"Deprecated Exceptions table, listing deprecated exceptions, and an explanation\">\n" 201 + "<caption><span>Deprecated Exceptions</span><span class=\"tabEnd\"> </span></caption>\n" 202 + "<tr>\n" 203 + "<th class=\"colFirst\" scope=\"col\">Exceptions</th>\n" 204 + "<th class=\"colLast\" scope=\"col\">Description</th>\n" 205 + "</tr>\n" 206 + "<tbody>\n" 207 + "<tr class=\"altColor\">\n" 208 + "<th class=\"colFirst\" scope=\"row\"><a href=\"pkg/TestException.html\" title=\"class in pkg\">pkg.TestException</a></th>\n" 209 + "<td class=\"colLast\">\n" 210 + "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n" 211 + "</td>\n" 212 + "</tr>\n" 213 + "</tbody>\n" 214 + "</table>"); 215 } 216} 217