use of com.sun.tools.javac.code.Attribute.TypeCompound in project checker-framework by typetools.
the class TypeParamElementAnnotationApplier method handleTargeted.
/**
* @param targeted the list of annotations that were on the lower/upper bounds of the type
* parameter
* <p>Note: When handling type parameters we NEVER add primary annotations to the type
* parameter. Primary annotations are reserved for the use of a type parameter (e.g. @Nullable
* T t; )
* <p>If an annotation is present on the type parameter itself, it represents the lower-bound
* annotation of that type parameter. Any annotation on the extends bound of a type parameter
* is placed on that bound.
*/
@Override
protected void handleTargeted(final List<TypeCompound> targeted) throws UnexpectedAnnotationLocationException {
final int paramIndex = getElementIndex();
final List<TypeCompound> upperBoundAnnos = new ArrayList<>();
final List<TypeCompound> lowerBoundAnnos = new ArrayList<>();
for (final TypeCompound anno : targeted) {
final AnnotationMirror aliasedAnno = typeFactory.canonicalAnnotation(anno);
final AnnotationMirror canonicalAnno = (aliasedAnno != null) ? aliasedAnno : anno;
if (anno.position.parameter_index != paramIndex || !typeFactory.isSupportedQualifier(canonicalAnno)) {
continue;
}
if (ElementAnnotationUtil.isOnComponentType(anno)) {
applyComponentAnnotation(anno);
} else if (anno.position.type == upperBoundTarget()) {
upperBoundAnnos.add(anno);
} else {
lowerBoundAnnos.add(anno);
}
}
applyLowerBounds(lowerBoundAnnos);
applyUpperBounds(upperBoundAnnos);
}
Aggregations