src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java
Print this page
rev 9918 : 8038994: AnnotatedType.getType() of a TypeVariable boundary without annotations return null
Reviewed-by: duke
*** 73,83 ****
for (TypeAnnotation t : tas) {
TypeAnnotationTargetInfo ti = t.getTargetInfo();
if (ti.getTarget() == filter)
l.add(t);
}
! TypeAnnotation[] typeAnnotations = l.toArray(new TypeAnnotation[0]);
return AnnotatedTypeFactory.buildAnnotatedType(type,
LocationInfo.BASE_LOCATION,
typeAnnotations,
typeAnnotations,
decl);
--- 73,83 ----
for (TypeAnnotation t : tas) {
TypeAnnotationTargetInfo ti = t.getTargetInfo();
if (ti.getTarget() == filter)
l.add(t);
}
! TypeAnnotation[] typeAnnotations = l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY);
return AnnotatedTypeFactory.buildAnnotatedType(type,
LocationInfo.BASE_LOCATION,
typeAnnotations,
typeAnnotations,
decl);
*** 243,253 ****
LocationInfo loc) {
List<TypeAnnotation> candidates = fetchBounds(decl);
if (bounds != null) {
int startIndex = 0;
AnnotatedType[] res = new AnnotatedType[bounds.length];
- Arrays.fill(res, AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE);
// Adjust bounds index
//
// Figure out if the type annotations for this bound starts with 0
// or 1. The spec says within a bound the 0:th type annotation will
--- 243,252 ----
*** 274,290 ****
TypeAnnotationTargetInfo tInfo = t.getTargetInfo();
if (tInfo.getSecondaryIndex() == i + startIndex &&
tInfo.getCount() == typeVarIndex) {
l.add(t);
}
res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
loc,
! l.toArray(new TypeAnnotation[0]),
! candidates.toArray(new TypeAnnotation[0]),
(AnnotatedElement)decl);
}
- }
return res;
}
return new AnnotatedType[0];
}
private static <D extends GenericDeclaration> List<TypeAnnotation> fetchBounds(D decl) {
--- 273,289 ----
TypeAnnotationTargetInfo tInfo = t.getTargetInfo();
if (tInfo.getSecondaryIndex() == i + startIndex &&
tInfo.getCount() == typeVarIndex) {
l.add(t);
}
+ }
res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
loc,
! l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
! candidates.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
(AnnotatedElement)decl);
}
return res;
}
return new AnnotatedType[0];
}
private static <D extends GenericDeclaration> List<TypeAnnotation> fetchBounds(D decl) {