--- old/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Fri Jan 22 12:28:11 2016 +++ /dev/null Fri Jan 22 12:28:11 2016 @@ -1,353 +0,0 @@ -/* - * Copyright (c) 2013, 2015, 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 8005091 8009686 8025633 8026567 - * @summary Make sure that type annotations are displayed correctly - * @author Bhavesh Patel - * @library ../lib - * @modules jdk.javadoc - * @ignore 8006735 output type annotations in javadoc - * @build JavadocTester - * @run main TestTypeAnnotations - */ - -public class TestTypeAnnotations extends JavadocTester { - - public static void main(String... args) throws Exception { - TestTypeAnnotations tester = new TestTypeAnnotations(); - tester.runTests(); - } - - @Test - void test() { - javadoc("-d", "out", - "-sourcepath", testSrc, - "-private", - "typeannos"); - checkExit(Exit.OK); - - // Test for type annotations on Class Extends (ClassExtends.java). - checkOutput("typeannos/MyClass.html", true, - "extends @ClassExtA ParameterizedClass<" - + "@ClassExtB java.lang.String>", - - "implements @ClassExtB java.lang.CharSequence, " - + "@ClassExtA ParameterizedInterface<" - + "@ClassExtB java.lang.String>"); - - checkOutput("typeannos/MyInterface.html", true, - "extends @ClassExtA " - + "ParameterizedInterface<@ClassExtA java.lang.String>, " - + "@ClassExtB java.lang.CharSequence"); - - // Test for type annotations on Class Parameters (ClassParameters.java). - checkOutput("typeannos/ExtendsBound.html", true, - "class ExtendsBound<K extends @ClassParamA java.lang.String>"); - - checkOutput("typeannos/ExtendsGeneric.html", true, - "
class ExtendsGeneric<K extends "
-                + "@ClassParamA Unannotated<"
-                + "@ClassParamB java.lang.String>>");
-
-        checkOutput("typeannos/TwoBounds.html", true,
-                "
class TwoBounds<K extends "
-                + "@ClassParamA java.lang.String,V extends @ClassParamB"
-                + " java.lang.String>");
-
-        checkOutput("typeannos/Complex1.html", true,
-                "class Complex1<K extends "
-                + "@ClassParamA java.lang.String & java.lang.Runnable>");
-
-        checkOutput("typeannos/Complex2.html", true,
-                "class Complex2<K extends java.lang."
-                + "String & @ClassParamB java.lang.Runnable>");
-
-        checkOutput("typeannos/ComplexBoth.html", true,
-                "class ComplexBoth<K extends @ClassParamA java.lang.String & @ClassParamA"
-                + " java.lang.Runnable>");
-
-        // Test for type annotations on fields (Fields.java).
-        checkOutput("typeannos/DefaultScope.html", true,
-                "
Parameterized<@FldA java.lang.String,"
-                + "@FldB java.lang.String> bothTypeArgs
", - - "
@FldA java.lang.String @FldB [] "
-                + "array1Deep
", - - "
java.lang.String[] @FldB [] array2SecondOld
", - - "
@FldD java.lang.String @FldC @FldA"
-                + " [] @FldC @FldB [] array2Deep
"); - - checkOutput("typeannos/ModifiedScoped.html", true, - "
public final Parameterized<@FldA "
-                + "Parameterized<@FldA java.lang.String,"
-                + "@FldB java.lang.String>,@FldB java.lang.String> "
-                + "nestedParameterized
", - - "
public final @FldA java.lang.String[][] "
-                + "array2
"); - - // Test for type annotations on method return types (MethodReturnType.java). - checkOutput("typeannos/MtdDefaultScope.html", true, - "
public <T> @MRtnA java.lang.String"
-                + " method()
", - - "
@MRtnA java.lang.String @MRtnA [] "
-                + "@MRtnB [] array2Deep()
", - - "
@MRtnA java.lang.String[][] array2()
"); - - checkOutput("typeannos/MtdModifiedScoped.html", true, - "
public final MtdParameterized<@MRtnA "
-                + "MtdParameterized<@MRtnA java.lang."
-                + "String,@MRtnB java.lang.String>,@MRtnB java."
-                + "lang.String> nestedMtdParameterized()
"); - - // Test for type annotations on method type parameters (MethodTypeParameters.java). - checkOutput("typeannos/UnscopedUnmodified.html", true, - "
<K extends @MTyParamA java.lang.String>"
-                + " void methodExtends()
", - - "
<K extends @MTyParamA "
-                + "MtdTyParameterized<@MTyParamB java.lang.String"
-                + ">> void nestedExtends()
"); - - checkOutput("typeannos/PublicModifiedMethods.html", true, - "
public final <K extends @MTyParamA "
-                + "java.lang.String> void methodExtends()
", - - "
public final <K extends @MTyParamA "
-                + "java.lang.String,V extends @MTyParamA "
-                + "MtdTyParameterized<@MTyParamB java.lang.String"
-                + ">> void dual()
"); - - // Test for type annotations on parameters (Parameters.java). - checkOutput("typeannos/Parameters.html", true, - "
void unannotated("
-                + "ParaParameterized<java.lang.String,java.lang.String>"
-                + " a)
", - - "
void nestedParaParameterized("
-                + "ParaParameterized<@ParamA "
-                + "ParaParameterized<@ParamA java.lang.String,"
-                + "@ParamB java.lang.String>,@ParamB"
-                + " java.lang.String> a)
", - - "
void array2Deep(@ParamA java.lang.String "
-                + "@ParamA [] @ParamB [] a)
"); - - // Test for type annotations on throws (Throws.java). - checkOutput("typeannos/ThrDefaultUnmodified.html", true, - "
void oneException()\n"
-                + "           throws @ThrA java.lang.Exception
", - - "
void twoExceptions()\n"
-                + "            throws @ThrA java.lang.RuntimeException,\n"
-                + "                   @ThrA java.lang.Exception
"); - - checkOutput("typeannos/ThrPublicModified.html", true, - "
public final void oneException(java.lang.String a)\n"
-                + "                        throws @ThrA java.lang.Exception
", - - "
public final void twoExceptions(java.lang.String a)\n"
-                + "                         throws @ThrA java.lang.RuntimeException,\n"
-                + "                                @ThrA java.lang.Exception
"); - - checkOutput("typeannos/ThrWithValue.html", true, - "
void oneException()\n"
-                + "           throws @ThrB(value=\"m\") java.lang.Exception
", - - "
void twoExceptions()\n"
-                + "            throws @ThrB(value=\"m\") java.lang.RuntimeException,\n"
-                + "                   @ThrA java.lang.Exception
"); - - // Test for type annotations on type parameters (TypeParameters.java). - checkOutput("typeannos/TestMethods.html", true, - "
<K,V extends @TyParaA java.lang.String> "
-                + "void secondAnnotated()
"); - - // Test for type annotations on wildcard type (Wildcards.java). - checkOutput("typeannos/BoundTest.html", true, - "
void wcExtends(MyList<? extends @WldA"
-                + " java.lang.String> l)
", - - "
MyList<? super @WldA java.lang.String>"
-                + " returnWcSuper()
"); - - checkOutput("typeannos/BoundWithValue.html", true, - "
void wcSuper(MyList<? super @WldB(value=\"m\") java.lang."
-                + "String> l)
", - - "
MyList<? extends @WldB(value=\"m\") java.lang.String"
-                + "> returnWcExtends()
"); - - // Test for receiver annotations (Receivers.java). - checkOutput("typeannos/DefaultUnmodified.html", true, - "
void withException(@RcvrA "
-                + "DefaultUnmodified this)\n"
-                + "            throws java."
-                + "lang.Exception
", - - "
java.lang.String nonVoid(@RcvrA @RcvrB"
-                + "(value=\"m\")"
-                + " DefaultUnmodified this)
", - - "
<T extends java.lang.Runnable> void accept("
-                + "@RcvrA DefaultUnmodified this,\n"
-                + "                                           T r)\n"
-                + "                                    throws java.lang.Exception
"); - - checkOutput("typeannos/PublicModified.html", true, - "
public final java.lang.String nonVoid("
-                + "@RcvrA PublicModified this)
", - - "
public final <T extends java.lang.Runnable> "
-                + "void accept(@RcvrA PublicModified this,\n"
-                + "                                                        T r)\n"
-                + "                                                 throws java.lang.Exception
"); - - checkOutput("typeannos/WithValue.html", true, - "
<T extends java.lang.Runnable> void accept("
-                + "@RcvrB("
-                + "value=\"m\") WithValue this,\n"
-                + "                                           T r)\n"
-                + "                                    throws java.lang.Exception
"); - - checkOutput("typeannos/WithFinal.html", true, - "
java.lang.String nonVoid(@RcvrB(value=\"m\") WithFinal"
-                + " this)
"); - - checkOutput("typeannos/WithBody.html", true, - "
void field(@RcvrA WithBody this)
"); - - checkOutput("typeannos/Generic2.html", true, - "
void test2(@RcvrA Generic2<X> this)
"); - } -} --- /dev/null Fri Jan 22 12:28:11 2016 +++ new/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Fri Jan 22 12:28:11 2016 @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2013, 2016, 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 8005091 8009686 8025633 8026567 + * @summary Make sure that type annotations are displayed correctly + * @author Bhavesh Patel + * @library ../lib + * @modules jdk.javadoc + * @build JavadocTester + * @run main TestTypeAnnotations + */ + +public class TestTypeAnnotations extends JavadocTester { + + public static void main(String... args) throws Exception { + TestTypeAnnotations tester = new TestTypeAnnotations(); + tester.runTests(); + } + + @Test + void test() { + javadoc("-d", "out", + "-sourcepath", testSrc, + "-private", + "typeannos"); + checkExit(Exit.OK); + + // Test for type annotations on Class Extends (ClassExtends.java). + checkOutput("typeannos/MyClass.html", true, + "extends @ClassExtA ParameterizedClass<" + + "@ClassExtB java.lang.String>", + + "implements @ClassExtB java.lang.CharSequence, " + + "@ClassExtA ParameterizedInterface<" + + "@ClassExtB java.lang.String>
"); + + checkOutput("typeannos/MyInterface.html", true, + "extends @ClassExtA " + + "ParameterizedInterface<@ClassExtA java.lang.String>, " + + "@ClassExtB java.lang.CharSequence
"); + + // Test for type annotations on Class Parameters (ClassParameters.java). + checkOutput("typeannos/ExtendsBound.html", true, + "class ExtendsBound<K extends @ClassParamA java.lang.String>"); + + checkOutput("typeannos/ExtendsGeneric.html", true, + "
class ExtendsGeneric<K extends "
+                + "@ClassParamA Unannotated<"
+                + "@ClassParamB java.lang.String>>");
+
+        checkOutput("typeannos/TwoBounds.html", true,
+                "
class TwoBounds<K extends "
+                + "@ClassParamA java.lang.String,V extends @ClassParamB"
+                + " java.lang.String>");
+
+        checkOutput("typeannos/Complex1.html", true,
+                "class Complex1<K extends "
+                + "@ClassParamA java.lang.String & java.lang.Runnable>");
+
+        checkOutput("typeannos/Complex2.html", true,
+                "class Complex2<K extends java.lang."
+                + "String & @ClassParamB java.lang.Runnable>");
+
+        checkOutput("typeannos/ComplexBoth.html", true,
+                "class ComplexBoth<K extends @ClassParamA java.lang.String & @ClassParamA"
+                + " java.lang.Runnable>");
+
+        // Test for type annotations on fields (Fields.java).
+        checkOutput("typeannos/DefaultScope.html", true,
+                "
Parameterized<@FldA java.lang.String,"
+                + "@FldB java.lang.String> bothTypeArgs
", + + "
@FldA java.lang.String @FldB [] "
+                + "array1Deep
", + + "
java.lang.String @FldB [][] array2SecondOld
", + + // When JDK-8068737, we should change the order + "
"
+                + "@FldD java.lang.String "
+                + "@FldC "
+                + "@FldB [] "
+                + "@FldC "
+                + "@FldA [] "
+                + "array2Deep
"); + + checkOutput("typeannos/ModifiedScoped.html", true, + "
public final Parameterized<@FldA "
+                + "Parameterized<@FldA java.lang.String,"
+                + "@FldB java.lang.String>,@FldB java.lang.String> "
+                + "nestedParameterized
", + + "
public final @FldA java.lang.String[][] "
+                + "array2
"); + + // Test for type annotations on method return types (MethodReturnType.java). + checkOutput("typeannos/MtdDefaultScope.html", true, + "
public <T> @MRtnA java.lang.String"
+                + " method()
", + + // When JDK-8068737 is fixed, we should change the order + "
"
+                + "@MRtnA java.lang.String "
+                + "@MRtnB [] "
+                + "@MRtnA []"
+                + " array2Deep()
", + + "
@MRtnA java.lang.String[][] array2()
"); + + checkOutput("typeannos/MtdModifiedScoped.html", true, + "
public final MtdParameterized<@MRtnA "
+                + "MtdParameterized<@MRtnA java.lang."
+                + "String,@MRtnB java.lang.String>,@MRtnB java."
+                + "lang.String> nestedMtdParameterized()
"); + + // Test for type annotations on method type parameters (MethodTypeParameters.java). + checkOutput("typeannos/UnscopedUnmodified.html", true, + "
<K extends @MTyParamA java.lang.String>"
+                + " void methodExtends()
", + + "
<K extends @MTyParamA "
+                + "MtdTyParameterized<@MTyParamB java.lang.String"
+                + ">> void nestedExtends()
"); + + checkOutput("typeannos/PublicModifiedMethods.html", true, + "
public final <K extends @MTyParamA "
+                + "java.lang.String> void methodExtends()
", + + "
public final <K extends @MTyParamA "
+                + "java.lang.String,V extends @MTyParamA "
+                + "MtdTyParameterized<@MTyParamB java.lang.String"
+                + ">> void dual()
"); + + // Test for type annotations on parameters (Parameters.java). + checkOutput("typeannos/Parameters.html", true, + "
void unannotated("
+                + "ParaParameterized<java.lang.String,java.lang.String>"
+                + " a)
", + + "
void nestedParaParameterized("
+                + "ParaParameterized<@ParamA "
+                + "ParaParameterized<@ParamA java.lang.String,"
+                + "@ParamB java.lang.String>,@ParamB"
+                + " java.lang.String> a)
", + + // When JDK-8068737 is fixed, we should change the order + "
void array2Deep(@ParamA java.lang.String "
+                + ""
+                + "@ParamB [] "
+                + ""
+                + "@ParamA []"
+                + " a)
"); + + // Test for type annotations on throws (Throws.java). + checkOutput("typeannos/ThrDefaultUnmodified.html", true, + "
void oneException()\n"
+                + "           throws @ThrA java.lang.Exception
", + + "
void twoExceptions()\n"
+                + "            throws @ThrA java.lang.RuntimeException,\n"
+                + "                   @ThrA java.lang.Exception
"); + + checkOutput("typeannos/ThrPublicModified.html", true, + "
public final void oneException(java.lang.String a)\n"
+                + "                        throws @ThrA java.lang.Exception
", + + "
public final void twoExceptions(java.lang.String a)\n"
+                + "                         throws @ThrA java.lang.RuntimeException,\n"
+                + "                                @ThrA java.lang.Exception
"); + + checkOutput("typeannos/ThrWithValue.html", true, + "
void oneException()\n"
+                + "           throws @ThrB(value=\"m\") java.lang.Exception
", + + "
void twoExceptions()\n"
+                + "            throws @ThrB(value=\"m\") java.lang.RuntimeException,\n"
+                + "                   @ThrA java.lang.Exception
"); + + // Test for type annotations on type parameters (TypeParameters.java). + checkOutput("typeannos/TestMethods.html", true, + "
<K,"
+                + "@TyParaA V extends @TyParaA "
+                + "java.lang.String> void secondAnnotated()
" + ); + + // Test for type annotations on wildcard type (Wildcards.java). + checkOutput("typeannos/BoundTest.html", true, + "
void wcExtends(MyList<? extends @WldA"
+                + " java.lang.String> l)
", + + "
MyList<? super @WldA java.lang.String>"
+                + " returnWcSuper()
"); + + checkOutput("typeannos/BoundWithValue.html", true, + "
void wcSuper(MyList<? super @WldB(value=\"m\") java.lang."
+                + "String> l)
", + + "
MyList<? extends @WldB(value=\"m\") java.lang.String"
+                + "> returnWcExtends()
"); + + // Test for receiver annotations (Receivers.java). + checkOutput("typeannos/DefaultUnmodified.html", true, + "
void withException(@RcvrA "
+                + "DefaultUnmodified this)\n"
+                + "            throws java."
+                + "lang.Exception
", + + "
java.lang.String nonVoid(@RcvrA @RcvrB"
+                + "(value=\"m\")"
+                + " DefaultUnmodified this)
", + + "
<T extends java.lang.Runnable> void accept("
+                + "@RcvrA DefaultUnmodified this,\n"
+                + "                                           T r)\n"
+                + "                                    throws java.lang.Exception
"); + + checkOutput("typeannos/PublicModified.html", true, + "
public final java.lang.String nonVoid("
+                + "@RcvrA PublicModified this)
", + + "
public final <T extends java.lang.Runnable> "
+                + "void accept(@RcvrA PublicModified this,\n"
+                + "                                                        T r)\n"
+                + "                                                 throws java.lang.Exception
"); + + checkOutput("typeannos/WithValue.html", true, + "
<T extends java.lang.Runnable> void accept("
+                + "@RcvrB("
+                + "value=\"m\") WithValue this,\n"
+                + "                                           T r)\n"
+                + "                                    throws java.lang.Exception
"); + + checkOutput("typeannos/WithFinal.html", true, + "
java.lang.String nonVoid(@RcvrB(value=\"m\") WithFinal"
+                + " this)
"); + + checkOutput("typeannos/WithBody.html", true, + "
void field(@RcvrA WithBody this)
"); + + checkOutput("typeannos/Generic2.html", true, + "
void test2(@RcvrA Generic2<X> this)
"); + } +}