182 decl.isArray() ||
183 decl.isPrimitive() ||
184 decl == Void.TYPE)
185 return AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE_ARRAY;
186 return buildAnnotatedTypes(rawAnnotations,
187 cp,
188 decl,
189 decl,
190 decl.getGenericInterfaces(),
191 TypeAnnotationTarget.CLASS_IMPLEMENTS);
192 }
193
194 // TypeVariable helpers
195
196 /**
197 * Parse regular annotations on a TypeVariable declared on genericDecl.
198 *
199 * Regular Annotations on TypeVariables are stored in the type
200 * annotation byte[] in the class file.
201 *
202 * @param genericsDecl the declaration declaring the type variable
203 * @param typeVarIndex the 0-based index of this type variable in the declaration
204 */
205 public static <D extends GenericDeclaration> Annotation[] parseTypeVariableAnnotations(D genericDecl,
206 int typeVarIndex) {
207 AnnotatedElement decl;
208 TypeAnnotationTarget predicate;
209 if (genericDecl instanceof Class) {
210 decl = (Class<?>)genericDecl;
211 predicate = TypeAnnotationTarget.CLASS_TYPE_PARAMETER;
212 } else if (genericDecl instanceof Executable) {
213 decl = (Executable)genericDecl;
214 predicate = TypeAnnotationTarget.METHOD_TYPE_PARAMETER;
215 } else {
216 throw new AssertionError("Unknown GenericDeclaration " + genericDecl + "\nthis should not happen.");
217 }
218 List<TypeAnnotation> typeVarAnnos = TypeAnnotation.filter(parseAllTypeAnnotations(decl),
219 predicate);
220 List<Annotation> res = new ArrayList<>(typeVarAnnos.size());
221 for (TypeAnnotation t : typeVarAnnos)
222 if (t.getTargetInfo().getCount() == typeVarIndex)
|
182 decl.isArray() ||
183 decl.isPrimitive() ||
184 decl == Void.TYPE)
185 return AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE_ARRAY;
186 return buildAnnotatedTypes(rawAnnotations,
187 cp,
188 decl,
189 decl,
190 decl.getGenericInterfaces(),
191 TypeAnnotationTarget.CLASS_IMPLEMENTS);
192 }
193
194 // TypeVariable helpers
195
196 /**
197 * Parse regular annotations on a TypeVariable declared on genericDecl.
198 *
199 * Regular Annotations on TypeVariables are stored in the type
200 * annotation byte[] in the class file.
201 *
202 * @param genericDecl the declaration declaring the type variable
203 * @param typeVarIndex the 0-based index of this type variable in the declaration
204 */
205 public static <D extends GenericDeclaration> Annotation[] parseTypeVariableAnnotations(D genericDecl,
206 int typeVarIndex) {
207 AnnotatedElement decl;
208 TypeAnnotationTarget predicate;
209 if (genericDecl instanceof Class) {
210 decl = (Class<?>)genericDecl;
211 predicate = TypeAnnotationTarget.CLASS_TYPE_PARAMETER;
212 } else if (genericDecl instanceof Executable) {
213 decl = (Executable)genericDecl;
214 predicate = TypeAnnotationTarget.METHOD_TYPE_PARAMETER;
215 } else {
216 throw new AssertionError("Unknown GenericDeclaration " + genericDecl + "\nthis should not happen.");
217 }
218 List<TypeAnnotation> typeVarAnnos = TypeAnnotation.filter(parseAllTypeAnnotations(decl),
219 predicate);
220 List<Annotation> res = new ArrayList<>(typeVarAnnos.size());
221 for (TypeAnnotation t : typeVarAnnos)
222 if (t.getTargetInfo().getCount() == typeVarIndex)
|