< prev index next >

test/jdk/java/lang/annotation/typeAnnotations/GetAnnotatedOwnerType.java

Print this page
rev 51789 : [mq]: asserts


   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 8058595
  27  * @summary Test that AnnotatedType.getAnnotatedOwnerType() works as expected
  28  *
  29  * @library /lib/testlibrary
  30  * @build jdk.testlibrary.Asserts
  31  * @run main GetAnnotatedOwnerType
  32  */
  33 
  34 import java.lang.annotation.*;
  35 import java.lang.reflect.*;
  36 
  37 import jdk.testlibrary.Asserts;
  38 
  39 public class GetAnnotatedOwnerType<Dummy> {
  40     public @TA("generic") GetAnnotatedOwnerType<String> . @TB("generic") Nested<Integer> genericField;
  41     public @TA("raw") GetAnnotatedOwnerType . @TB("raw") Nested rawField;
  42     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("non-generic") Inner nonGeneric;
  43     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("generic") InnerGeneric<String> innerGeneric;
  44     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("raw") InnerGeneric innerRaw;
  45     public Object anonymous = new Object() {};
  46     public @TA("array") Dummy[] dummy;
  47     public @TA("wildcard") GetAnnotatedOwnerType<?> wildcard;
  48     public @TA("typevariable") Dummy tv;
  49     public @TA("bad") GetAnnotatedOwnerType<@TA("good") GetAnnotatedOwnerType<String> . @TB("tb") Nested<Integer> >  typeArgument;
  50     public GetAnnotatedOwnerType< GetAnnotatedOwnerType<String> .
  51             B .
  52             C<Class<?>, ? extends @TA("complicated") Exception> .
  53             D<Number> > [] complicated;
  54 
  55     public static void main(String[] args) throws Exception {
  56         testGeneric();
  57         testRaw();




   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 8058595
  27  * @summary Test that AnnotatedType.getAnnotatedOwnerType() works as expected
  28  *
  29  * @library /test/lib
  30  * @build jdk.test.lib.Asserts
  31  * @run main GetAnnotatedOwnerType
  32  */
  33 
  34 import java.lang.annotation.*;
  35 import java.lang.reflect.*;
  36 
  37 import jdk.test.lib.Asserts;
  38 
  39 public class GetAnnotatedOwnerType<Dummy> {
  40     public @TA("generic") GetAnnotatedOwnerType<String> . @TB("generic") Nested<Integer> genericField;
  41     public @TA("raw") GetAnnotatedOwnerType . @TB("raw") Nested rawField;
  42     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("non-generic") Inner nonGeneric;
  43     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("generic") InnerGeneric<String> innerGeneric;
  44     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("raw") InnerGeneric innerRaw;
  45     public Object anonymous = new Object() {};
  46     public @TA("array") Dummy[] dummy;
  47     public @TA("wildcard") GetAnnotatedOwnerType<?> wildcard;
  48     public @TA("typevariable") Dummy tv;
  49     public @TA("bad") GetAnnotatedOwnerType<@TA("good") GetAnnotatedOwnerType<String> . @TB("tb") Nested<Integer> >  typeArgument;
  50     public GetAnnotatedOwnerType< GetAnnotatedOwnerType<String> .
  51             B .
  52             C<Class<?>, ? extends @TA("complicated") Exception> .
  53             D<Number> > [] complicated;
  54 
  55     public static void main(String[] args) throws Exception {
  56         testGeneric();
  57         testRaw();


< prev index next >