public class KeyForValue extends org.checkerframework.framework.flow.CFAbstractValue<KeyForValue>
Inside the if statement,Map<T, Object> map = ...;
<T> T method(T param) { } if (map.contains(param) { {@code @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)
.Constructor and Description |
---|
KeyForValue(org.checkerframework.framework.flow.CFAbstractAnalysis<KeyForValue,?,?> analysis,
Set<AnnotationMirror> annotations,
TypeMirror underlyingType) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getKeyForMaps()
If the underlying type is a type variable or a wildcard, then this is a set of maps for which
this value is a key.
|
KeyForValue |
leastUpperBound(KeyForValue other) |
KeyForValue |
mostSpecific(KeyForValue other,
KeyForValue backup) |
public KeyForValue(org.checkerframework.framework.flow.CFAbstractAnalysis<KeyForValue,?,?> analysis, Set<AnnotationMirror> annotations, TypeMirror underlyingType)
public Set<String> getKeyForMaps()
public KeyForValue leastUpperBound(KeyForValue other)
leastUpperBound
in interface org.checkerframework.dataflow.analysis.AbstractValue<KeyForValue>
leastUpperBound
in class org.checkerframework.framework.flow.CFAbstractValue<KeyForValue>
public KeyForValue mostSpecific(KeyForValue other, KeyForValue backup)
mostSpecific
in class org.checkerframework.framework.flow.CFAbstractValue<KeyForValue>