diff -r 9b4c916633f8 -r 4e6a73cb55da test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java --- a/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Fri Mar 11 13:00:33 2016 +0100 +++ b/test/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Mon Mar 14 15:04:57 2016 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8005091 8009686 8025633 8026567 6469562 + * @bug 8005091 8009686 8025633 8026567 6469562 8071982 8071984 * @summary Make sure that type annotations are displayed correctly * @author Bhavesh Patel * @library ../lib @@ -355,5 +355,369 @@ checkOutput("typeannos/Generic2.html", true, "
void test2(@RcvrA Generic2<X> this)
"); + + + // Test for repeated type annotations (RepeatedAnnotations.java). + checkOutput("typeannos/RepeatingAtClassLevel.html", true, + "
@RepTypeA @RepTypeA\n"
+                + "@RepTypeB @RepTypeB\nclass RepeatingAtClassLevel\nextends "
+                + "java.lang.Object
"); + +// @ignore 8146008 +// checkOutput("typeannos/RepeatingAtClassLevel2.html", true, +// "
@RepTypeUseA @RepTypeUseA\n@RepTypeUseB @RepTypeUseB\nclass RepeatingAtClassLevel2\nextends "
+//                + "java.lang.Object
"); +// +// checkOutput("typeannos/RepeatingAtClassLevel2.html", true, +// "
@RepAllContextsA @RepAllContextsA\n@RepAllContextsB @RepAllContextsB\n"
+//                + "class RepeatingAtClassLevel3\n"
+//                + "extends java.lang.Object
"); + + checkOutput("typeannos/RepeatingOnConstructor.html", true, + "
@RepConstructorA @RepConstructorA\n@RepConstructorB @RepConstructorB\n"
+                + "RepeatingOnConstructor()
", + + "
@RepConstructorA @RepConstructorA\n@RepConstructorB @RepConstructorB\n"
+                + "RepeatingOnConstructor(int i,\n                       int j)
", + + "
@RepAllContextsA @RepAllContextsA\n"
+                + "@RepAllContextsB @RepAllContextsB\n"
+                + "RepeatingOnConstructor(int i,\n                       int j,\n"
+                + "                       int k)
", + + "
RepeatingOnConstructor(@RepParameterA @RepParameterA @RepParameterB "
+                + "@RepParameterB\n                       java.lang.String parameter,\n"
+                + "                       @RepParameterA "
+                + "@RepParameterA @RepParameterB "
+                + "@RepParameterB\n                       java.lang.String "
+                + ""
+                + "@RepTypeUseA @RepTypeUseA @RepTypeUseB "
+                + ""
+                + "@RepTypeUseB ... vararg)
" + ); + + checkOutput("typeannos/RepeatingOnConstructor.Inner.html", true, + "Inner" + + "(java.lang.String parameter,\n java.lang.String " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "@RepTypeUseB ... vararg)", + + "Inner(" + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "@RepTypeUseB RepeatingOnConstructor this,\n " + + "@RepParameterA @RepParameterA @RepParameterB " + + "@RepParameterB\n java.lang.String parameter,\n" + + " " + + "@RepParameterA @RepParameterA @RepParameterB " + + "@RepParameterB\n java.lang.String @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB ... vararg)"); + + checkOutput("typeannos/RepeatingOnField.html", true, + "(package private) java.lang.Integer\n" + + "i1", + + "(package private) @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.Integer\n" + + "i2", + + "(package private) @RepTypeUseA @RepTypeUseA " + + "@RepTypeUseB @RepTypeUseB java.lang.Integer" + + "\n" + + "i3", + + "(package private) @RepAllContextsA @RepAllContextsA " + + "@RepAllContextsB @RepAllContextsB java.lang.Integer" + + "\n" + + "i4", + + "(package private) java.lang.String @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB [] " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "@RepTypeUseB []\nsa", + + "
"
+                + "@RepFieldA @RepFieldA\n@RepFieldB "
+                + "@RepFieldB\njava.lang.Integer i1
", + + "
@RepTypeUseA @RepTypeUseA "
+                + ""
+                + "@RepTypeUseB @RepTypeUseB java.lang.Integer i2
", + + "
"
+                + "@RepFieldA @RepFieldA\n@RepFieldB "
+                + "@RepFieldB\n@RepTypeUseA @RepTypeUseA "
+                + "@RepTypeUseB @RepTypeUseB java.lang.Integer i3
", + + "
"
+                + "@RepAllContextsA @RepAllContextsA\n"
+                + "@RepAllContextsB @RepAllContextsB\n"
+                + ""
+                + "@RepAllContextsA @RepAllContextsA "
+                + "@RepAllContextsB @RepAllContextsB java.lang.Integer i4
", + + "
java.lang.String @RepTypeUseA @RepTypeUseA "
+                + "@RepTypeUseB @RepTypeUseB [] "
+                + "@RepTypeUseA @RepTypeUseA @RepTypeUseB "
+                + "@RepTypeUseB [] sa
"); + + checkOutput("typeannos/RepeatingOnMethod.html", true, + "(package private) java.lang.String\ntest1()", + + "(package private) @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.String" + + "\n" + + "test2" + + "()", + + "(package private) @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.String" + + "\n" + + "test3" + + "()", + + "(package private) @RepAllContextsA " + + "@RepAllContextsA @RepAllContextsB " + + "@RepAllContextsB java.lang.String\n" + + "test4()", + + "test5" + + "(java.lang.String parameter,\n java.lang.String " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "@RepTypeUseB ... vararg)", + + "" + + "@RepMethodA @RepMethodA\n@RepMethodB " + + "@RepMethodB\njava.lang.String test1()", + + "" + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.String test2()", + + "" + + "@RepMethodA @RepMethodA\n@RepMethodB " + + "@RepMethodB\n@RepTypeUseA @RepTypeUseA " + + "@RepTypeUseB @RepTypeUseB java.lang.String test3()", + + "" + + "@RepAllContextsA @RepAllContextsA\n" + + "@RepAllContextsB @RepAllContextsB\n" + + "@RepAllContextsA @RepAllContextsA " + + "@RepAllContextsB @RepAllContextsB java.lang.String test4()", + + "java.lang.String test5(@RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnMethod " + + "this,\n @RepParameterA " + + "@RepParameterA @RepParameterB " + + "@RepParameterB\n java.lang.String parameter,\n" + + " @RepParameterA @RepParameterA " + + "@RepParameterB @RepParameterB\n " + + "java.lang.String @RepTypeUseA @RepTypeUseA " + + "@RepTypeUseB @RepTypeUseB ... vararg)"); + + checkOutput("typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html", true, + "(package private) <T> java.lang.String\n" + + "genericMethod(T t)", + + "(package private) <T> java.lang.String\n" + + "genericMethod2(@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T t)", + + "(package private) java.lang.String\n" + + "test()", + + "java.lang.String test(@RepTypeUseA " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB " + + "RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod<" + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T> this)"); + + checkOutput("typeannos/RepeatingOnVoidMethodDeclaration.html", true, + "" + + "@RepMethodA @RepMethodA\n@RepMethodB " + + "@RepMethodB\nvoid test()"); } } diff -r 9b4c916633f8 -r 4e6a73cb55da test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/RepeatedAnnotations.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/javadoc/doclet/testTypeAnnotations/typeannos/RepeatedAnnotations.java Mon Mar 14 15:04:57 2016 -0700 @@ -0,0 +1,346 @@ +/* + * Copyright (c) 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 RepeatingA 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. + */ + +package typeannos; + +import java.lang.annotation.*; +import static java.lang.annotation.ElementType.*; + +/* + * This class is partially replicated from test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java; CombinationsTargetTest2.java; CombinationsTargetTest3.java + */ +@RepTypeA @RepTypeA @RepTypeB @RepTypeB class RepeatingAtClassLevel { +} + +@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB class RepeatingAtClassLevel2 { +} + +@RepAllContextsA @RepAllContextsA @RepAllContextsB @RepAllContextsB class RepeatingAtClassLevel3 { +} + +class RepeatingOnConstructor { + + @RepConstructorA @RepConstructorA @RepConstructorB @RepConstructorB + RepeatingOnConstructor() { + } + + @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnConstructor(int i) { + } + + @RepConstructorA @RepConstructorA @RepConstructorB @RepConstructorB + @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnConstructor(int i, int j) { + } + + @RepAllContextsA @RepAllContextsA @RepAllContextsB @RepAllContextsB RepeatingOnConstructor(int i, int j, int k) { + } + + RepeatingOnConstructor(@RepParameterA @RepParameterA @RepParameterB @RepParameterB String parameter, @RepParameterA @RepParameterA @RepParameterB @RepParameterB String @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB ... vararg) { + } + + class Inner { + Inner(@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnConstructor RepeatingOnConstructor.this, @RepParameterA @RepParameterA @RepParameterB @RepParameterB String parameter, @RepParameterA @RepParameterA @RepParameterB @RepParameterB String @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB ... vararg) { + } + } +} + +class RepeatingOnField { + @RepFieldA @RepFieldA @RepFieldB @RepFieldB + Integer i1; + + @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB Integer i2; + + @RepFieldA @RepFieldA @RepFieldB @RepFieldB + @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB Integer i3; + + @RepAllContextsA @RepAllContextsA @RepAllContextsB @RepAllContextsB Integer i4; + + String @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB [] @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB [] sa = null; +} + +class RepeatingOnMethod { + + @RepMethodA @RepMethodA @RepMethodB @RepMethodB + String test1() { + return null; + } + + @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB String test2() { + return null; + } + + @RepMethodA @RepMethodA @RepMethodB @RepMethodB + @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB String test3() { + return null; + } + + @RepAllContextsA @RepAllContextsA @RepAllContextsB @RepAllContextsB String test4() { + return null; + } + + String test5(@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnMethod this, @RepParameterA @RepParameterA @RepParameterB @RepParameterB String parameter, @RepParameterA @RepParameterA @RepParameterB @RepParameterB String @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB ... vararg) { + return null; + } +} + +class RepeatingOnTypeParametersBoundsTypeArgumentsOnClassDecl <@RepTypeParameterA @RepTypeParameterA @RepTypeParameterB @RepTypeParameterB T extends @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB Object> { + + String genericMethod(T t) { + return null; + } +} + +class RepeatingOnTypeParametersBoundsTypeArgumentsOnClassDecl2 <@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T extends @RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB Object> { + + String genericMethod(T t) { + return null; + } +} + +class RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod { + + String test(@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod<@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T> this) { + return null; + } + + <@RepTypeParameterA @RepTypeParameterA @RepTypeParameterB @RepTypeParameterB T> String genericMethod(@RepParameterA @RepParameterA @RepParameterB @RepParameterB T t) { + return null; + } + + <@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T> String genericMethod2(@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T t) { + return null; + } +} + +class RepeatingOnVoidMethodDeclaration { + + @RepMethodA @RepMethodA @RepMethodB @RepMethodB void test() {} +} + +class RepeatingOnStaticMethodOfInterface { + + interface I { + static @RepMethodA @RepMethodA @RepMethodB @RepMethodB String m() { + return null; + } + } +} + +//------------------------------------------------------------------------------ +@Target({TYPE}) +@Repeatable(ContTypeA.class) +@Documented +@interface RepTypeA { } + +@Target({TYPE}) +@Documented +@interface ContTypeA { RepTypeA[] value(); } + +@Target({TYPE}) +@Repeatable(ContTypeB.class) +@Documented +@interface RepTypeB { } + +@Target({TYPE}) +@Documented +@interface ContTypeB { RepTypeB[] value(); } + +//------------------------------------------------------------------------------ +@Target({CONSTRUCTOR}) +@Repeatable(ContConstructorA.class) +@Documented +@interface RepConstructorA { } + +@Target({CONSTRUCTOR}) +@Documented +@interface ContConstructorA { RepConstructorA[] value(); } + +@Target({CONSTRUCTOR}) +@Repeatable(ContConstructorB.class ) +@Documented +@interface RepConstructorB { } + +@Target({CONSTRUCTOR}) +@Documented +@interface ContConstructorB { RepConstructorB[] value(); } + +//------------------------------------------------------------------------------ +@Target({METHOD}) +@Repeatable(ContMethodA.class) +@Documented +@interface RepMethodA {} + +@Target({METHOD}) +@Documented +@interface ContMethodA { + RepMethodA[] value(); +} + +@Target({METHOD}) +@Repeatable(ContMethodB.class) +@Documented +@interface RepMethodB {} + +@Target({METHOD}) +@Documented +@interface ContMethodB { + RepMethodB[] value(); +} + +//------------------------------------------------------------------------------ +@Target({FIELD}) +@Repeatable(ContFieldA.class) +@Documented +@interface RepFieldA {} + +@Target({FIELD}) +@Documented +@interface ContFieldA { + RepFieldA[] value(); +} + +@Target({FIELD}) +@Repeatable(ContFieldB.class) +@Documented +@interface RepFieldB {} + +@Target({FIELD}) +@Documented +@interface ContFieldB { + RepFieldB[] value(); +} + +//------------------------------------------------------------------------------ +@Target({TYPE_USE}) +@Repeatable(ContTypeUseA.class) +@Documented +@interface RepTypeUseA {} + +@Target({TYPE_USE}) +@Documented +@interface ContTypeUseA { + RepTypeUseA[] value(); +} + +@Target({TYPE_USE}) +@Repeatable(ContTypeUseB.class) +@Documented +@interface RepTypeUseB {} + +@Target({TYPE_USE}) +@Documented +@interface ContTypeUseB { + RepTypeUseB[] value(); +} + +//------------------------------------------------------------------------------ +@Target({TYPE_PARAMETER}) +@Repeatable(ContTypeParameterA.class) +@Documented +@interface RepTypeParameterA {} + +@Target({TYPE_PARAMETER}) +@Documented +@interface ContTypeParameterA { + RepTypeParameterA[] value(); +} + +@Target({TYPE_PARAMETER}) +@Repeatable(ContTypeParameterB.class) +@Documented +@interface RepTypeParameterB {} + +@Target({TYPE_PARAMETER}) +@Documented +@interface ContTypeParameterB { + RepTypeParameterB[] value(); +} + +//------------------------------------------------------------------------------ +@Target({PARAMETER}) +@Repeatable(ContParameterA.class) +@Documented +@interface RepParameterA {} + +@Target({PARAMETER}) +@Documented +@interface ContParameterA { + RepParameterA[] value(); +} + +@Target({PARAMETER}) +@Repeatable(ContParameterB.class) +@Documented +@interface RepParameterB {} + +@Target({PARAMETER}) +@Documented +@interface ContParameterB { + RepParameterB[] value(); +} + + +//------------------------------------------------------------------------------ +@Target({PACKAGE}) +@Repeatable(ContPackageA.class) +@Documented +@interface RepPackageA {} + +@Target({PACKAGE}) +@Documented +@interface ContPackageA { + RepPackageA[] value(); +} + +@Target({PACKAGE}) +@Repeatable(ContPackageB.class) +@Documented +@interface RepPackageB {} + +@Target({PACKAGE}) +@Documented +@interface ContPackageB { + RepPackageB[] value(); +} + +//------------------------------------------------------------------------------ +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE, TYPE_PARAMETER, TYPE_USE}) +@Repeatable(ContAllContextsA.class) +@Documented +@interface RepAllContextsA {} + +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE, TYPE_PARAMETER, TYPE_USE}) +@Documented +@interface ContAllContextsA { + RepAllContextsA[] value(); +} + +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE, TYPE_PARAMETER, TYPE_USE}) +@Repeatable(ContAllContextsB.class) +@Documented +@interface RepAllContextsB {} + +@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE, TYPE_PARAMETER, TYPE_USE}) +@Documented +@interface ContAllContextsB { + RepAllContextsB[] value(); +}