/* * Copyright (c) 2003, 2017, 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 * @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, "
@Deprecated\n"
                + "public class DeprecatedClassByAnnotation\n"
                + "extends java.lang.Object
", "
@Deprecated(forRemoval=true)\n"
                + "public int field
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.
", "
@Deprecated(forRemoval=true)\n"
                + "public DeprecatedClassByAnnotation()
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.
", "
@Deprecated\n"
                + "public void method()
\n" + "
Deprecated.
"); checkOutput("pkg/TestAnnotationType.html", true, "
\n" + "
@Deprecated(forRemoval=true)\n"
                + "@Documented\n"
                + "public @interface TestAnnotationType
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
annotation_test1 passes.
\n" + "
", "
@Deprecated(forRemoval=true)\n"
                + "static final int field
\n" + "
Deprecated, for removal: This " + "API element is subject to removal in a future version.\n" + "
annotation_test4 passes.
\n" + "
", "
@Deprecated(forRemoval=true)\n"
                + "int required
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
annotation_test3 passes.
\n" + "
", "
java.lang.String optional
\n" + "
Deprecated.\n" + "
annotation_test2 passes.
\n" + "
"); checkOutput("pkg/TestClass.html", true, "
\n" + "
@Deprecated(forRemoval=true)\n"
                + "public class TestClass\n"
                + "extends java.lang.Object
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
class_test1 passes.
\n" + "
", "
@Deprecated(forRemoval=true)\n"
                + "public TestClass()
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
class_test3 passes. This is the second sentence of deprecated description for a constructor.
\n" + "
", "\n" + "
Deprecated.\n" + "
class_test2 passes.
\n" + "
\n" + "", "\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
class_test3 passes.
\n" + "
\n" + "", "\n" + "
Deprecated.\n" + "
class_test4 passes.
\n" + "
\n" + ""); checkOutput("pkg/TestClass.html", false, "
class_test2 passes. This is the second sentence of deprecated description for a field.
\n" + "\n" + "", "
class_test3 passes. This is the second sentence of deprecated description for a constructor.
\n" + "\n" + "", "
class_test4 passes. This is the second sentence of deprecated description for a method.
\n" + "\n" + ""); checkOutput("pkg/TestEnum.html", true, "
\n" + "
@Deprecated(forRemoval=true)\n"
                + "public enum TestEnum\n"
                + "extends java.lang.Enum<TestEnum>
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
enum_test1 passes.
\n" + "
", "
@Deprecated(forRemoval=true)\n"
                + "public static final TestEnum FOR_REMOVAL
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
enum_test3 passes.
\n" + "
"); checkOutput("pkg/TestError.html", true, "
\n" + "
@Deprecated(forRemoval=true)\n"
                + "public class TestError\n"
                + "extends java.lang.Error
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
error_test1 passes.
\n" + "
"); checkOutput("pkg/TestException.html", true, "
\n" + "
@Deprecated(forRemoval=true)\n"
                + "public class TestException\n"
                + "extends java.lang.Exception
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
exception_test1 passes.
\n" + "
"); checkOutput("pkg/TestInterface.html", true, "
\n" + "
@Deprecated(forRemoval=true)\n"
                + "public class TestInterface\n"
                + "extends java.lang.Object
\n" + "
Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
interface_test1 passes.
\n" + "
"); checkOutput("deprecated-list.html", true, "", "", "\n" + "\n" + "\n" + "\n" + "\n" + "", "
For Removal 
ElementDescription
\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
Enums 
EnumDescription
pkg.TestEnum\n" + "
enum_test1 passes.
\n" + "
", "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
Exceptions 
ExceptionsDescription
pkg.TestException\n" + "
exception_test1 passes.
\n" + "
", "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
Fields 
FieldDescription
pkg.DeprecatedClassByAnnotation.field
pkg.TestAnnotationType.field\n" + "
annotation_test4 passes.
\n" + "
pkg.TestClass.field\n" + "
class_test2 passes. This is the second sentence of deprecated description for a field.
\n" + "
pkg.TestError.field\n" + "
error_test2 passes.
\n" + "
pkg.TestException.field\n" + "
exception_test2 passes.
\n" + "
pkg.TestInterface.field\n" + "
interface_test2 passes.
\n" + "
"); } }