Class CFAbstractValue<V extends CFAbstractValue<V>>
- All Implemented Interfaces:
- AbstractValue<V>
- Direct Known Subclasses:
- CFValue,- KeyForValue,- NullnessValue
A value holds a set of annotations and a type mirror. The set of annotations represents the primary annotation on a type; therefore, the set of annotations must have an annotation for each hierarchy unless the type mirror is a type variable or a wildcard that extends a type variable. Both type variables and wildcards may be missing a primary annotation. For this set of annotations, there is an additional constraint that only wildcards that extend type variables can be missing annotations.
In order to compute leastUpperBound(CFAbstractValue) and mostSpecific(CFAbstractValue, CFAbstractValue), the case where one value has an annotation in a
 hierarchy and the other does not must be handled. For type variables, the AnnotatedTypeMirror.AnnotatedTypeVariable for the declaration of the type variable is used. The AnnotatedTypeMirror.AnnotatedTypeVariable is computed using the type mirror. For wildcards, it is not always
 possible to get the AnnotatedTypeMirror.AnnotatedWildcardType for the type mirror. However, a
 CFAbstractValue's type mirror is only a wildcard if the type of some expression is a wildcard.
 The type of an expression is only a wildcard because the Checker Framework does not implement
 capture conversion. For these uses of uncaptured wildcards, only the primary annotation on the
 upper bound is ever used. So, the set of annotations represents the primary annotation on the
 wildcard's upper bound. If that upper bound is a type variable, then the set of annotations could
 be missing an annotation in a hierarchy.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classCombines two sets of AnnotationMirrors by hierarchy.protected classComputes the GLB of two sets of annotations.protected classComputes the least upper bound or, ifshouldWidenis true, an upper bounds of two sets of annotations.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final CFAbstractAnalysis<V,?, ?> The analysis class this value belongs to.protected final AnnotationMirrorSetThe annotations in this abstract value.protected final TypeMirrorThe underlying (Java) type in this abstract value.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedCFAbstractValue(CFAbstractAnalysis<V, ?, ?> analysis, AnnotationMirrorSet annotations, TypeMirror underlyingType) Creates a new CFAbstractValue.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns whether or not the set of annotations can be missing an annotation for any hierarchy.booleanReturns a set of annotations.greatestLowerBound(@Nullable V other) Compute the greatest lower bound of two values.inthashCode()leastUpperBound(@Nullable V other) Compute the least upper bound of two values.mostSpecific(@Nullable V other, @Nullable V backup) Returns the more specific version of two valuesthisandother.toString()Returns the string representation.Returns the string representation, using fully-qualified names.Returns the string representation, using simple (not fully-qualified) names.static booleanvalidateSet(AnnotationMirrorSet annos, TypeMirror typeMirror, QualifierHierarchy hierarchy) Returns true if the set has an annotation from every hierarchy (or if it doesn't need to); returns false if the set is missing an annotation from some hierarchy.widenUpperBound(@Nullable V previous) Compute an upper bound of two values that is wider than the least upper bound of the two values.
- 
Field Details- 
analysisThe analysis class this value belongs to.
- 
underlyingTypeThe underlying (Java) type in this abstract value.
- 
annotationsThe annotations in this abstract value.
 
- 
- 
Constructor Details- 
CFAbstractValueprotected CFAbstractValue(CFAbstractAnalysis<V, ?, ?> analysis, AnnotationMirrorSet annotations, TypeMirror underlyingType) Creates a new CFAbstractValue.- Parameters:
- analysis- the analysis class this value belongs to
- annotations- the annotations in this abstract value
- underlyingType- the underlying (Java) type in this abstract value
 
 
- 
- 
Method Details- 
validateSetpublic static boolean validateSet(AnnotationMirrorSet annos, TypeMirror typeMirror, QualifierHierarchy hierarchy) Returns true if the set has an annotation from every hierarchy (or if it doesn't need to); returns false if the set is missing an annotation from some hierarchy.- Parameters:
- annos- set of annotations
- typeMirror- where the annotations are written
- hierarchy- the qualifier hierarchy
- Returns:
- true if no annotations are missing
 
- 
canBeMissingAnnotationspublic boolean canBeMissingAnnotations()Returns whether or not the set of annotations can be missing an annotation for any hierarchy.- Returns:
- whether or not the set of annotations can be missing an annotation
 
- 
getAnnotationsReturns a set of annotations. IfcanBeMissingAnnotations()returns true, then the set of annotations may not have an annotation for every hierarchy.To get the single annotation in a particular hierarchy, use QualifierHierarchy.findAnnotationInHierarchy(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror>, javax.lang.model.element.AnnotationMirror).- Returns:
- a set of annotations
 
- 
getUnderlyingType
- 
equals
- 
hashCode
- 
toStringFullyQualifiedReturns the string representation, using fully-qualified names.- Returns:
- the string representation, using fully-qualified names
 
- 
toStringSimpleReturns the string representation, using simple (not fully-qualified) names.- Returns:
- the string representation, using simple (not fully-qualified) names
 
- 
toStringReturns the string representation.
- 
mostSpecificReturns the more specific version of two valuesthisandother. If they do not contain information for all hierarchies, then it is possible that information from boththisandotherare taken.If neither of the two is more specific for one of the hierarchies (i.e., if the two are incomparable as determined by QualifierHierarchy.isSubtype(AnnotationMirror, AnnotationMirror), then the respective value frombackupis used.
- 
leastUpperBoundDescription copied from interface:AbstractValueCompute the least upper bound of two values.Important: This method must fulfill the following contract: - Does not change this.
- Does not change other.
- Returns a fresh object which is not aliased yet.
- Returns an object of the same (dynamic) type as this, even if the signature is more permissive.
- Is commutative.
 - Specified by:
- leastUpperBoundin interface- AbstractValue<V extends CFAbstractValue<V>>
 
- Does not change 
- 
widenUpperBoundCompute an upper bound of two values that is wider than the least upper bound of the two values. Used to jump to a higher abstraction to allow faster termination of the fixed point computations inAnalysis.A particular analysis might not require widening and should implement this method by calling leastUpperBound. Important: This method must fulfill the following contract: - Does not change this.
- Does not change previous.
- Returns a fresh object which is not aliased yet.
- Returns an object of the same (dynamic) type as this, even if the signature is more permissive.
- Is commutative.
 - Parameters:
- previous- must be the previous value
- Returns:
- an upper bound of two values that is wider than the least upper bound of the two values
 
- Does not change 
- 
greatestLowerBoundCompute the greatest lower bound of two values.Important: This method must fulfill the following contract: - Does not change this.
- Does not change other.
- Returns a fresh object which is not aliased yet.
- Returns an object of the same (dynamic) type as this, even if the signature is more permissive.
- Is commutative.
 - Parameters:
- other- another value
- Returns:
- the greatest lower bound of two values
 
- Does not change 
 
-