Search in sources :

Example 1 with Supertypes

use of org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes in project checker-framework by typetools.

the class ConstraintMap method addTypeSupertype.

/**
 * Add a constraint indicating that target is a supertype of subtype in the given qualifier
 * hierarchies
 *
 * @param hierarchies a set of TOP annotations
 */
public void addTypeSupertype(final TypeVariable target, final AnnotatedTypeMirror subtype, AnnotationMirrorSet hierarchies) {
    final Supertypes supertypes = targetToRecords.get(target).supertypes;
    final AnnotationMirrorSet supertypeTops = supertypes.types.get(subtype);
    if (supertypeTops == null) {
        supertypes.types.put(subtype, new AnnotationMirrorSet(hierarchies));
    } else {
        supertypeTops.addAll(hierarchies);
    }
}
Also used : AnnotationMirrorSet(org.checkerframework.framework.util.AnnotationMirrorSet) Supertypes(org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes)

Example 2 with Supertypes

use of org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes in project checker-framework by typetools.

the class ConstraintMap method addTargetSupertype.

/**
 * Add a constraint indicating that target is a supertype of subtype in the given qualifier
 * hierarchies
 *
 * @param hierarchies a set of TOP annotations
 */
public void addTargetSupertype(final TypeVariable target, final TypeVariable subtype, AnnotationMirrorSet hierarchies) {
    final Supertypes supertypes = targetToRecords.get(target).supertypes;
    final AnnotationMirrorSet supertypeTops = supertypes.targets.get(subtype);
    if (supertypeTops == null) {
        supertypes.targets.put(subtype, new AnnotationMirrorSet(hierarchies));
    } else {
        supertypeTops.addAll(hierarchies);
    }
}
Also used : AnnotationMirrorSet(org.checkerframework.framework.util.AnnotationMirrorSet) Supertypes(org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes)

Example 3 with Supertypes

use of org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes in project checker-framework by typetools.

the class ConstraintMap method addPrimarySupertype.

/**
 * Add a constraint indicating that target's primary annotations are subtypes of the given
 * annotations
 */
public void addPrimarySupertype(final TypeVariable target, QualifierHierarchy qualifierHierarchy, final AnnotationMirrorSet annos) {
    final Supertypes supertypes = targetToRecords.get(target).supertypes;
    for (final AnnotationMirror anno : annos) {
        final AnnotationMirror top = qualifierHierarchy.getTopAnnotation(anno);
        AnnotationMirrorSet entries = supertypes.primaries.get(top);
        if (entries == null) {
            entries = new AnnotationMirrorSet();
            supertypes.primaries.put(top, entries);
        }
        entries.add(anno);
    }
}
Also used : AnnotationMirror(javax.lang.model.element.AnnotationMirror) AnnotationMirrorSet(org.checkerframework.framework.util.AnnotationMirrorSet) Supertypes(org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes)

Aggregations

AnnotationMirrorSet (org.checkerframework.framework.util.AnnotationMirrorSet)3 Supertypes (org.checkerframework.framework.util.typeinference.solver.TargetConstraints.Supertypes)3 AnnotationMirror (javax.lang.model.element.AnnotationMirror)1