Class KeyForValue
java.lang.Object
org.checkerframework.framework.flow.CFAbstractValue<KeyForValue>
org.checkerframework.checker.nullness.KeyForValue
- All Implemented Interfaces:
- AbstractValue<KeyForValue>
KeyForValue holds additional information about which maps this value is a key for. This extra
 information is required when adding the @KeyFor qualifier to the type is not a refinement of the
 type. For example,
 
     @NonNull Object o = map.get(param);
 
 
 Map<T, Object> map = ...;
 <T> T method(T param) {
   if (map.contains(param)) {
     @NonNull Object o = map.get(param);
     return param;
   }
 }
 param is a key for "map". This would normally be represented as
 @KeyFor("map") T, but this is not a subtype of T, so the type cannot be refined.
 Instead, the value for param includes "map" in the list of keyForMaps. This information
 is used in KeyForAnnotatedTypeFactory.isKeyForMap(String, ExpressionTree).- 
Nested Class SummaryNested classes/interfaces inherited from class org.checkerframework.framework.flow.CFAbstractValueCFAbstractValue.AnnotationSetCombiner, CFAbstractValue.ValueGlb, CFAbstractValue.ValueLub
- 
Field SummaryFields inherited from class org.checkerframework.framework.flow.CFAbstractValueanalysis, annotations, atypeFactory, qualHierarchy, underlyingType
- 
Constructor SummaryConstructorsConstructorDescriptionKeyForValue(CFAbstractAnalysis<KeyForValue, ?, ?> analysis, AnnotationMirrorSet annotations, TypeMirror underlyingType) Create a KeyForValue.
- 
Method SummaryModifier and TypeMethodDescriptionIf the underlying type is a type variable or a wildcard, then this is a set of maps for which this value is a key.leastUpperBound(@Nullable KeyForValue other) Compute the least upper bound of two values.mostSpecific(@Nullable KeyForValue other, @Nullable KeyForValue backup) Returns the more specific of two valuesthisandother.Methods inherited from class org.checkerframework.framework.flow.CFAbstractValuecanBeMissingAnnotations, equals, getAnnotations, getUnderlyingType, greatestLowerBound, hashCode, toString, toStringFullyQualified, toStringSimple, validateSet, widenUpperBound
- 
Constructor Details- 
KeyForValuepublic KeyForValue(CFAbstractAnalysis<KeyForValue, ?, ?> analysis, AnnotationMirrorSet annotations, TypeMirror underlyingType) Create a KeyForValue.- Parameters:
- analysis- the analysis
- annotations- the annotations
- underlyingType- the underlying type
 
 
- 
- 
Method Details- 
getKeyForMapsIf the underlying type is a type variable or a wildcard, then this is a set of maps for which this value is a key. Otherwise, it's null.
- 
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<KeyForValue>
- Overrides:
- leastUpperBoundin class- CFAbstractValue<KeyForValue>
 
- Does not change 
- 
mostSpecificpublic @Nullable KeyForValue mostSpecific(@Nullable KeyForValue other, @Nullable KeyForValue backup) Description copied from class:CFAbstractValueReturns the more specific 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.isSubtypeShallow(AnnotationMirror, TypeMirror, AnnotationMirror, TypeMirror), then the respective value frombackupis used.- Overrides:
- mostSpecificin class- CFAbstractValue<KeyForValue>
- Parameters:
- other- the other value to obtain information from
- backup- the value to use if- thisand- otherare incomparable
- Returns:
- the more specific of two values thisandother
 
 
-