use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class ElementQualifierHierarchy method getPolymorphicAnnotation.
@Override
@Nullable
public AnnotationMirror getPolymorphicAnnotation(AnnotationMirror start) {
QualifierKind polyKind = getQualifierKind(start).getPolymorphic();
if (polyKind == null) {
return null;
}
AnnotationMirror poly = kindToElementlessQualifier.get(polyKind);
if (poly == null) {
throw new TypeSystemError("Poly %s has an element. Override ElementQualifierHierarchy#getPolymorphicAnnotation.", polyKind);
}
return poly;
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class MostlyNoElementQualifierHierarchy method leastUpperBound.
@Override
@Nullable
public final AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2) {
QualifierKind qual1 = getQualifierKind(a1);
QualifierKind qual2 = getQualifierKind(a2);
QualifierKind lub = qualifierKindHierarchy.leastUpperBound(qual1, qual2);
if (lub == null) {
// Qualifiers are not in the same hierarchy.
return null;
}
if (lub.hasElements()) {
return leastUpperBoundWithElements(a1, qual1, a2, qual2, lub);
}
return kindToElementlessQualifier.get(lub);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class MostlyNoElementQualifierHierarchy method greatestLowerBound.
@Override
@Nullable
public final AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2) {
QualifierKind qual1 = getQualifierKind(a1);
QualifierKind qual2 = getQualifierKind(a2);
QualifierKind glb = qualifierKindHierarchy.greatestLowerBound(qual1, qual2);
if (glb == null) {
// Qualifiers are not in the same hierarchy.
return null;
}
if (glb.hasElements()) {
return greatestLowerBoundWithElements(a1, qual1, a2, qual2, glb);
}
return kindToElementlessQualifier.get(glb);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class NoElementQualifierHierarchy method isSubtype.
@Override
public boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno) {
QualifierKind subKind = getQualifierKind(subAnno);
QualifierKind superKind = getQualifierKind(superAnno);
return subKind.isSubtypeOf(superKind);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class NoElementQualifierHierarchy method getQualifierKind.
/**
* Returns the {@link QualifierKind} for the given annotation.
*
* @param anno an annotation that is a qualifier in this
* @return the {@code QualifierKind} for the given annotation
*/
protected QualifierKind getQualifierKind(AnnotationMirror anno) {
String name = AnnotationUtils.annotationName(anno);
QualifierKind kind = qualifierKindHierarchy.getQualifierKind(name);
if (kind == null) {
throw new BugInCF("Annotation not in hierarchy: %s", anno);
}
return kind;
}
Aggregations