use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class NoElementQualifierHierarchy method createTops.
/**
* Creates and returns the unmodifiable set of top {@link AnnotationMirror}s.
*
* @return the unmodifiable set of top {@link AnnotationMirror}s
*/
@RequiresNonNull({ "this.kindToAnnotationMirror", "this.qualifierKindHierarchy" })
protected Set<AnnotationMirror> createTops(@UnderInitialization NoElementQualifierHierarchy this, ) {
Set<AnnotationMirror> tops = AnnotationUtils.createAnnotationSet();
for (QualifierKind top : qualifierKindHierarchy.getTops()) {
@SuppressWarnings(// All QualifierKinds are keys in kindToAnnotationMirror
"nullness:assignment") @NonNull AnnotationMirror topAnno = kindToAnnotationMirror.get(top);
tops.add(topAnno);
}
return Collections.unmodifiableSet(tops);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class NoElementQualifierHierarchy method greatestLowerBound.
@Override
@Nullable
public AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2) {
QualifierKind qual1 = getQualifierKind(a1);
QualifierKind qual2 = getQualifierKind(a2);
QualifierKind glb = qualifierKindHierarchy.greatestLowerBound(qual1, qual2);
if (glb == null) {
return null;
}
return kindToAnnotationMirror.get(glb);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class NoElementQualifierHierarchy method createBottoms.
/**
* Creates and returns the unmodifiable set of bottom {@link AnnotationMirror}s.
*
* @return the unmodifiable set of bottom {@link AnnotationMirror}s
*/
@RequiresNonNull({ "this.kindToAnnotationMirror", "this.qualifierKindHierarchy" })
protected Set<AnnotationMirror> createBottoms(@UnderInitialization NoElementQualifierHierarchy this, ) {
Set<AnnotationMirror> bottoms = AnnotationUtils.createAnnotationSet();
for (QualifierKind bottom : qualifierKindHierarchy.getBottoms()) {
@SuppressWarnings(// All QualifierKinds are keys in kindToAnnotationMirror
"nullness:assignment") @NonNull AnnotationMirror bottomAnno = kindToAnnotationMirror.get(bottom);
bottoms.add(bottomAnno);
}
return Collections.unmodifiableSet(bottoms);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class NoElementQualifierHierarchy method leastUpperBound.
@Override
@Nullable
public AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2) {
QualifierKind qual1 = getQualifierKind(a1);
QualifierKind qual2 = getQualifierKind(a2);
QualifierKind lub = qualifierKindHierarchy.leastUpperBound(qual1, qual2);
if (lub == null) {
return null;
}
return kindToAnnotationMirror.get(lub);
}
use of org.checkerframework.framework.util.QualifierKind in project checker-framework by typetools.
the class MostlyNoElementQualifierHierarchy method isSubtype.
@Override
public final boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno) {
QualifierKind subKind = getQualifierKind(subAnno);
QualifierKind superKind = getQualifierKind(superAnno);
if (subKind.isSubtypeOf(superKind)) {
if (superKind.hasElements() && subKind.hasElements()) {
return isSubtypeWithElements(subAnno, subKind, superAnno, superKind);
} else {
return true;
}
}
return false;
}
Aggregations