51 // targets. They are included here to confirm that their omission is |
51 // targets. They are included here to confirm that their omission is |
52 // intentional omission not an accidental omission. |
52 // intentional omission not an accidental omission. |
53 // |
53 // |
54 |
54 |
55 /** For annotations on typecasts. */ |
55 /** For annotations on typecasts. */ |
56 TYPECAST(0x00), |
56 TYPECAST(0x00, IsLocal), |
57 |
57 |
58 /** For annotations on a type argument or nested array of a typecast. */ |
58 /** For annotations on a type argument or nested array of a typecast. */ |
59 TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation), |
59 TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation, IsLocal), |
60 |
60 |
61 /** For annotations on type tests. */ |
61 /** For annotations on type tests. */ |
62 INSTANCEOF(0x02), |
62 INSTANCEOF(0x02, IsLocal), |
63 |
63 |
64 /** For annotations on a type argument or nested array of a type test. */ |
64 /** For annotations on a type argument or nested array of a type test. */ |
65 INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation), |
65 INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation, IsLocal), |
66 |
66 |
67 /** For annotations on object creation expressions. */ |
67 /** For annotations on object creation expressions. */ |
68 NEW(0x04), |
68 NEW(0x04, IsLocal), |
69 |
69 |
70 /** |
70 /** |
71 * For annotations on a type argument or nested array of an object creation |
71 * For annotations on a type argument or nested array of an object creation |
72 * expression. |
72 * expression. |
73 */ |
73 */ |
74 NEW_GENERIC_OR_ARRAY(0x05, HasLocation), |
74 NEW_GENERIC_OR_ARRAY(0x05, HasLocation, IsLocal), |
75 |
75 |
76 |
76 |
77 /** For annotations on the method receiver. */ |
77 /** For annotations on the method receiver. */ |
78 METHOD_RECEIVER(0x06), |
78 METHOD_RECEIVER(0x06), |
79 |
79 |
80 // invalid location |
80 // invalid location |
81 //@Deprecated METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation), |
81 //@Deprecated METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation), |
82 |
82 |
83 /** For annotations on local variables. */ |
83 /** For annotations on local variables. */ |
84 LOCAL_VARIABLE(0x08), |
84 LOCAL_VARIABLE(0x08, IsLocal), |
85 |
85 |
86 /** For annotations on a type argument or nested array of a local. */ |
86 /** For annotations on a type argument or nested array of a local. */ |
87 LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation), |
87 LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation, IsLocal), |
88 |
88 |
89 // handled by regular annotations |
89 // handled by regular annotations |
90 //@Deprecated METHOD_RETURN(0x0A), |
90 //@Deprecated METHOD_RETURN(0x0A), |
91 |
91 |
92 /** |
92 /** |
136 |
136 |
137 // invalid location |
137 // invalid location |
138 //@Deprecated THROWS_GENERIC_OR_ARRAY(0x17, HasLocation), |
138 //@Deprecated THROWS_GENERIC_OR_ARRAY(0x17, HasLocation), |
139 |
139 |
140 /** For annotations in type arguments of object creation expressions. */ |
140 /** For annotations in type arguments of object creation expressions. */ |
141 NEW_TYPE_ARGUMENT(0x18), |
141 NEW_TYPE_ARGUMENT(0x18, IsLocal), |
142 NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation), |
142 NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation, IsLocal), |
143 |
143 |
144 METHOD_TYPE_ARGUMENT(0x1A), |
144 METHOD_TYPE_ARGUMENT(0x1A, IsLocal), |
145 METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation), |
145 METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation, IsLocal), |
146 |
146 |
147 WILDCARD_BOUND(0x1C, HasBound), |
147 WILDCARD_BOUND(0x1C, HasBound), |
148 WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation), |
148 WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation), |
149 |
149 |
150 CLASS_LITERAL(0x1E), |
150 CLASS_LITERAL(0x1E, IsLocal), |
151 CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation), |
151 CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation, IsLocal), |
152 |
152 |
153 METHOD_TYPE_PARAMETER(0x20, HasParameter), |
153 METHOD_TYPE_PARAMETER(0x20, HasParameter), |
154 |
154 |
155 // invalid location |
155 // invalid location |
156 //@Deprecated METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter), |
156 //@Deprecated METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter), |
214 * @return true if this TargetType represents an type parameter bound |
214 * @return true if this TargetType represents an type parameter bound |
215 * annotation, false otherwise |
215 * annotation, false otherwise |
216 */ |
216 */ |
217 public boolean hasBound() { |
217 public boolean hasBound() { |
218 return flags.contains(HasBound); |
218 return flags.contains(HasBound); |
|
219 } |
|
220 |
|
221 /** |
|
222 * Returns whether or not this TargetType represents an annotation whose |
|
223 * target is exclusively a tree in a method body |
|
224 * |
|
225 * Note: wildcard bound targets could target a local tree and a class |
|
226 * member declaration signature tree |
|
227 */ |
|
228 public boolean isLocal() { |
|
229 return flags.contains(IsLocal); |
219 } |
230 } |
220 |
231 |
221 public int targetTypeValue() { |
232 public int targetTypeValue() { |
222 return this.targetTypeValue; |
233 return this.targetTypeValue; |
223 } |
234 } |