Class ConstraintMap
java.lang.Object
org.checkerframework.framework.util.typeinference.solver.ConstraintMap
ConstraintMap holds simplified versions of the TUConstraints for ALL type variable for which we
are inferring an argument. The ConstraintMap is edited on the fly as the various solvers work
(unlike the AF/TU Constraints which are immutable).
This really consists of these things:
- a Map(
target => constraints for target
) - Methods to easily build up the constraints in the map
- A getter for the constraints of individual targets.
-
Constructor Summary
ConstructorDescriptionConstraintMap
(Set<TypeVariable> targets) ConstraintMap
(ConstraintMap toCopy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPrimaryEqualities
(TypeVariable target, QualifierHierarchy qualHierarchy, AnnotationMirrorSet annos) Add a constraint indicating that target has primary annotations equal to the given annotations.void
addPrimarySubtypes
(TypeVariable target, QualifierHierarchy qualHierarchy, AnnotationMirrorSet annos) Add a constraint indicating that target's primary annotations are subtypes of the given annotations.void
addPrimarySupertype
(TypeVariable target, QualifierHierarchy qualHierarchy, AnnotationMirrorSet annos) Add a constraint indicating that target's primary annotations are subtypes of the given annotations.void
addTargetEquality
(TypeVariable target, TypeVariable equivalent, AnnotationMirrorSet hierarchies) Add a constraint indicating that the equivalent is equal to target in the given qualifier hierarchies.void
addTargetSubtype
(TypeVariable target, TypeVariable supertype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a subtype of supertype in the given qualifier hierarchies.void
addTargetSupertype
(TypeVariable target, TypeVariable subtype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a supertype of subtype in the given qualifier hierarchies.void
addTypeEqualities
(TypeVariable target, AnnotatedTypeMirror type, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is equal to type in the given hierarchies.void
addTypeSubtype
(TypeVariable target, AnnotatedTypeMirror supertype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a subtype of supertype in the given qualifier hierarchies.void
addTypeSupertype
(TypeVariable target, AnnotatedTypeMirror subtype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a supertype of subtype in the given qualifier hierarchies.getConstraints
(TypeVariable target) Gets the equality, subtypes, and supertypes constraints for a particular target.Returns the set of all targets passed to the constructor of this constraint map (a target will appear in this list whether or not it has any constraints added).
-
Constructor Details
-
ConstraintMap
-
ConstraintMap
-
-
Method Details
-
getConstraints
Gets the equality, subtypes, and supertypes constraints for a particular target. -
getTargets
Returns the set of all targets passed to the constructor of this constraint map (a target will appear in this list whether or not it has any constraints added).- Returns:
- the set of all targets passed to the constructor of this constraint map (a target will appear in this list whether or not it has any constraints added)
-
addTargetEquality
public void addTargetEquality(TypeVariable target, TypeVariable equivalent, AnnotationMirrorSet hierarchies) Add a constraint indicating that the equivalent is equal to target in the given qualifier hierarchies. -
addPrimaryEqualities
public void addPrimaryEqualities(TypeVariable target, QualifierHierarchy qualHierarchy, AnnotationMirrorSet annos) Add a constraint indicating that target has primary annotations equal to the given annotations. -
addTargetSupertype
public void addTargetSupertype(TypeVariable target, TypeVariable subtype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a supertype of subtype in the given qualifier hierarchies.- Parameters:
hierarchies
- a set of TOP annotations
-
addTypeSupertype
public void addTypeSupertype(TypeVariable target, AnnotatedTypeMirror subtype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a supertype of subtype in the given qualifier hierarchies.- Parameters:
hierarchies
- a set of TOP annotations
-
addPrimarySupertype
public void addPrimarySupertype(TypeVariable target, QualifierHierarchy qualHierarchy, AnnotationMirrorSet annos) Add a constraint indicating that target's primary annotations are subtypes of the given annotations. -
addTargetSubtype
public void addTargetSubtype(TypeVariable target, TypeVariable supertype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a subtype of supertype in the given qualifier hierarchies.- Parameters:
hierarchies
- a set of TOP annotations
-
addTypeSubtype
public void addTypeSubtype(TypeVariable target, AnnotatedTypeMirror supertype, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is a subtype of supertype in the given qualifier hierarchies.- Parameters:
hierarchies
- a set of TOP annotations
-
addPrimarySubtypes
public void addPrimarySubtypes(TypeVariable target, QualifierHierarchy qualHierarchy, AnnotationMirrorSet annos) Add a constraint indicating that target's primary annotations are subtypes of the given annotations. -
addTypeEqualities
public void addTypeEqualities(TypeVariable target, AnnotatedTypeMirror type, AnnotationMirrorSet hierarchies) Add a constraint indicating that target is equal to type in the given hierarchies.- Parameters:
hierarchies
- a set of TOP annotations
-