author | jfranck |
Wed, 16 Dec 2015 20:00:03 +0100 | |
changeset 34708 | 4a1e3728135c |
permissions | -rw-r--r-- |
34708
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
1 |
/* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
4 |
* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
8 |
* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
13 |
* accompanied this code). |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
14 |
* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
18 |
* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
21 |
* questions. |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
22 |
*/ |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
23 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
24 |
/* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
25 |
* @test |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
26 |
* @bug 8058595 |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
27 |
* @summary Test that AnnotatedType.getAnnotatedOwnerType() works as expected |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
28 |
* |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
29 |
* @library /lib/testlibrary |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
30 |
* @build jdk.testlibrary.Asserts |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
31 |
* @run main GetAnnotatedOwnerType |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
32 |
*/ |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
33 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
34 |
import java.lang.annotation.*; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
35 |
import java.lang.reflect.*; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
36 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
37 |
import jdk.testlibrary.Asserts; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
38 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
39 |
public class GetAnnotatedOwnerType<Dummy> { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
40 |
public @TA("generic") GetAnnotatedOwnerType<String> . @TB("generic") Nested<Integer> genericField; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
41 |
public @TA("raw") GetAnnotatedOwnerType . @TB("raw") Nested rawField; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
42 |
public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("non-generic") Inner nonGeneric; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
43 |
public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("generic") InnerGeneric<String> innerGeneric; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
44 |
public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("raw") InnerGeneric innerRaw; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
45 |
public Object anonymous = new Object() {}; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
46 |
public @TA("array") Dummy[] dummy; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
47 |
public @TA("wildcard") GetAnnotatedOwnerType<?> wildcard; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
48 |
public @TA("typevariable") Dummy tv; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
49 |
public @TA("bad") GetAnnotatedOwnerType<@TA("good") GetAnnotatedOwnerType<String> . @TB("tb") Nested<Integer> > typeArgument; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
50 |
public GetAnnotatedOwnerType< GetAnnotatedOwnerType<String> . |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
51 |
B . |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
52 |
C<Class<?>, ? extends @TA("complicated") Exception> . |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
53 |
D<Number> > [] complicated; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
54 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
55 |
public static void main(String[] args) throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
56 |
testGeneric(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
57 |
testRaw(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
58 |
testNonGeneric(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
59 |
testInnerGeneric(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
60 |
testInnerRaw(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
61 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
62 |
testLocalClass(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
63 |
testAnonymousClass(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
64 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
65 |
testArray(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
66 |
testWildcard(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
67 |
testTypeParameter(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
68 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
69 |
testTypeArgument(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
70 |
testComplicated(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
71 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
72 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
73 |
public static void testGeneric() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
74 |
Field f = GetAnnotatedOwnerType.class.getField("genericField"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
75 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
76 |
// make sure inner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
77 |
AnnotatedType inner = f.getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
78 |
Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
79 |
Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
80 |
+ inner.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
81 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
82 |
// make sure owner is correctly annotated, on the correct type |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
83 |
AnnotatedType outer = inner.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
84 |
Asserts.assertEquals(outer.getType(), ((ParameterizedType) f.getGenericType()).getOwnerType()); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
85 |
Asserts.assertEquals(outer.getAnnotation(TA.class).value(), "generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
86 |
Asserts.assertTrue(outer.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
87 |
+ outer.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
88 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
89 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
90 |
public static void testRaw() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
91 |
Field f = GetAnnotatedOwnerType.class.getField("rawField"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
92 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
93 |
// make sure inner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
94 |
AnnotatedType inner = f.getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
95 |
Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "raw"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
96 |
Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
97 |
+ inner.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
98 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
99 |
// make sure owner is correctly annotated, on the correct type |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
100 |
AnnotatedType outer = inner.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
101 |
Asserts.assertEquals(outer.getType(), ((Class<?>)f.getGenericType()).getEnclosingClass()); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
102 |
Asserts.assertEquals(outer.getAnnotation(TA.class).value(), "raw"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
103 |
Asserts.assertTrue(outer.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
104 |
+ outer.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
105 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
106 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
107 |
public static void testNonGeneric() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
108 |
Field f = GetAnnotatedOwnerType.class.getField("nonGeneric"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
109 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
110 |
// make sure inner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
111 |
AnnotatedType inner = f.getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
112 |
Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "non-generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
113 |
Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
114 |
+ inner.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
115 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
116 |
// make sure owner is correctly annotated, on the correct type |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
117 |
AnnotatedType outer = inner.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
118 |
Asserts.assertEquals(outer.getType(), ((Class<?>)f.getGenericType()).getEnclosingClass()); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
119 |
Asserts.assertEquals(outer.getAnnotation(TA.class).value(), "non-generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
120 |
Asserts.assertTrue(outer.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
121 |
+ outer.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
122 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
123 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
124 |
public static void testInnerGeneric() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
125 |
Field f = GetAnnotatedOwnerType.class.getField("innerGeneric"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
126 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
127 |
// make sure inner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
128 |
AnnotatedType inner = f.getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
129 |
Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
130 |
Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
131 |
+ inner.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
132 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
133 |
// make sure owner is correctly annotated, on the correct type |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
134 |
AnnotatedType outer = inner.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
135 |
Asserts.assertEquals(outer.getType(), ((ParameterizedType) f.getGenericType()).getOwnerType()); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
136 |
Asserts.assertEquals(outer.getAnnotation(TA.class).value(), "non-generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
137 |
Asserts.assertTrue(outer.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
138 |
+ outer.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
139 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
140 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
141 |
public static void testInnerRaw() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
142 |
Field f = GetAnnotatedOwnerType.class.getField("innerRaw"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
143 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
144 |
// make sure inner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
145 |
AnnotatedType inner = f.getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
146 |
Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "raw"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
147 |
Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
148 |
+ inner.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
149 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
150 |
// make sure owner is correctly annotated, on the correct type |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
151 |
AnnotatedType outer = inner.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
152 |
Asserts.assertEquals(outer.getType(), ((Class<?>)f.getGenericType()).getEnclosingClass()); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
153 |
Asserts.assertEquals(outer.getAnnotation(TA.class).value(), "non-generic"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
154 |
Asserts.assertTrue(outer.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
155 |
+ outer.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
156 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
157 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
158 |
public static void testLocalClass() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
159 |
class ALocalClass {} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
160 |
class OneMore { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
161 |
public @TA("null") ALocalClass c; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
162 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
163 |
testNegative(OneMore.class.getField("c").getAnnotatedType(), "Local class should return null"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
164 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
165 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
166 |
public static void testAnonymousClass() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
167 |
testNegative(GetAnnotatedOwnerType.class.getField("anonymous").getAnnotatedType(), |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
168 |
"Anonymous class should return null"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
169 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
170 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
171 |
public static void testArray() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
172 |
AnnotatedType t = GetAnnotatedOwnerType.class.getField("dummy").getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
173 |
Asserts.assertTrue((t instanceof AnnotatedArrayType), |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
174 |
"Was expecting an AnnotatedArrayType " + t); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
175 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
176 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
177 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
178 |
public static void testWildcard() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
179 |
AnnotatedType tt = GetAnnotatedOwnerType.class.getField("wildcard").getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
180 |
AnnotatedType t = ((AnnotatedParameterizedType)tt).getAnnotatedActualTypeArguments()[0]; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
181 |
Asserts.assertTrue((t instanceof AnnotatedWildcardType), |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
182 |
"Was expecting an AnnotatedWildcardType " + t); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
183 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
184 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
185 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
186 |
public static void testTypeParameter() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
187 |
AnnotatedType t = GetAnnotatedOwnerType.class.getField("tv").getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
188 |
Asserts.assertTrue((t instanceof AnnotatedTypeVariable), |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
189 |
"Was expecting an AnnotatedTypeVariable " + t); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
190 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
191 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
192 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
193 |
public static void testTypeArgument() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
194 |
AnnotatedType tt = GetAnnotatedOwnerType.class.getField("typeArgument").getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
195 |
Asserts.assertEquals(tt.getAnnotation(TA.class).value(), "bad"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
196 |
Asserts.assertTrue(tt.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
197 |
+ tt.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
198 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
199 |
// make sure inner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
200 |
AnnotatedType inner = ((AnnotatedParameterizedType)tt).getAnnotatedActualTypeArguments()[0]; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
201 |
Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "tb"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
202 |
Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
203 |
+ inner.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
204 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
205 |
// make sure owner is correctly annotated |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
206 |
AnnotatedType outer = inner.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
207 |
Asserts.assertEquals(outer.getAnnotation(TA.class).value(), "good"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
208 |
Asserts.assertTrue(outer.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
209 |
+ outer.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
210 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
211 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
212 |
public static void testComplicated() throws Exception { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
213 |
Field f = GetAnnotatedOwnerType.class.getField("complicated"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
214 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
215 |
// Outermost level |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
216 |
AnnotatedType t = f.getAnnotatedType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
217 |
Asserts.assertTrue((t instanceof AnnotatedArrayType), |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
218 |
"Was expecting an AnnotatedArrayType " + t); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
219 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
220 |
Asserts.assertTrue(t.getAnnotations().length == 0, "expecting zero annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
221 |
+ t.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
222 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
223 |
// Component type |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
224 |
t = ((AnnotatedArrayType)t).getAnnotatedGenericComponentType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
225 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
226 |
Asserts.assertTrue(t.getAnnotations().length == 0, "expecting zero annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
227 |
+ t.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
228 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
229 |
// Type arg GetAnnotatedOwnerType<String>...D<Number> |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
230 |
t = ((AnnotatedParameterizedType)t).getAnnotatedActualTypeArguments()[0]; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
231 |
Asserts.assertTrue(t.getAnnotations().length == 0, "expecting zero annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
232 |
+ t.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
233 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
234 |
// C<Class<?>, ? extends ...> |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
235 |
t = t.getAnnotatedOwnerType(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
236 |
Asserts.assertTrue(t.getAnnotations().length == 0, "expecting zero annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
237 |
+ t.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
238 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
239 |
// ? extends |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
240 |
t = ((AnnotatedParameterizedType)t).getAnnotatedActualTypeArguments()[1]; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
241 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
242 |
Asserts.assertTrue(t.getAnnotations().length == 0, "expecting zero annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
243 |
+ t.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
244 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
245 |
// @TA("complicated") Exception |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
246 |
t = ((AnnotatedWildcardType)t).getAnnotatedUpperBounds()[0]; |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
247 |
testNegative(t, "" + t + " should not have an annotated owner type"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
248 |
Asserts.assertEquals(t.getAnnotation(TA.class).value(), "complicated"); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
249 |
Asserts.assertTrue(t.getAnnotations().length == 1, "expecting one (1) annotation, got: " |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
250 |
+ t.getAnnotations().length); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
251 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
252 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
253 |
private static void testNegative(AnnotatedType t, String msg) { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
254 |
Asserts.assertNull(t.getAnnotatedOwnerType(), msg); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
255 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
256 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
257 |
public class Nested<AlsoDummy> {} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
258 |
public class B { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
259 |
public class C<R, S> { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
260 |
public class D<T> { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
261 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
262 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
263 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
264 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
265 |
@Target(ElementType.TYPE_USE) |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
266 |
@Retention(RetentionPolicy.RUNTIME) |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
267 |
public @interface TA { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
268 |
String value(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
269 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
270 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
271 |
@Target(ElementType.TYPE_USE) |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
272 |
@Retention(RetentionPolicy.RUNTIME) |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
273 |
public @interface TB { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
274 |
String value(); |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
275 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
276 |
} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
277 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
278 |
class GetAnnotatedOwnerTypeAuxilliary { |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
279 |
class Inner {} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
280 |
|
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
281 |
class InnerGeneric<Dummy> {} |
4a1e3728135c
8057804: AnnotatedType interfaces provide no way to get annotations on owner type
jfranck
parents:
diff
changeset
|
282 |
} |