Class InferenceResult
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<javax.lang.model.type.TypeVariable,InferredValue>
-
- org.checkerframework.framework.util.typeinference.solver.InferenceResult
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<javax.lang.model.type.TypeVariable,InferredValue>
public class InferenceResult extends java.util.LinkedHashMap<javax.lang.model.type.TypeVariable,InferredValue>
Represents the result from inferring type arguments. InferenceResult is a map from: target type variable to (inferred type or target).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InferenceResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<javax.lang.model.type.TypeVariable>
getRemainingTargets(java.util.Set<javax.lang.model.type.TypeVariable> allTargets, boolean inferredTypesOnly)
Returns the set of targets that still don't have an inferred argument.boolean
isComplete(java.util.Set<javax.lang.model.type.TypeVariable> targets)
Returns true if we have inferred a concrete type for all targets.void
mergeSubordinate(InferenceResult subordinate)
Merges values in subordinate into this result, keeping the results form any type arguments that were already contained by this InferenceResult.protected @Nullable InferredValue.InferredType
mergeTarget(javax.lang.model.type.TypeVariable target, InferenceResult subordinate)
Performs a merge for a specific target, we keep only results that lead to a concrete type.void
resolveChainedTargets()
If we had a set of inferred results, (e.g.java.util.Map<javax.lang.model.type.TypeVariable,AnnotatedTypeMirror>
toAtmMap()
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
getRemainingTargets
public java.util.Set<javax.lang.model.type.TypeVariable> getRemainingTargets(java.util.Set<javax.lang.model.type.TypeVariable> allTargets, boolean inferredTypesOnly)
Returns the set of targets that still don't have an inferred argument.- Returns:
- the set of targets that still don't have an inferred argument
-
isComplete
public boolean isComplete(java.util.Set<javax.lang.model.type.TypeVariable> targets)
Returns true if we have inferred a concrete type for all targets.- Parameters:
targets
- type variables to check- Returns:
- true if we have inferred a concrete type for all targets
-
resolveChainedTargets
public void resolveChainedTargets()
If we had a set of inferred results, (e.g. T1 = T2, T2 = T3, T3 = String) propagate any results we have (the above constraints become T1 = String, T2 = String, T3 = String)
-
toAtmMap
public java.util.Map<javax.lang.model.type.TypeVariable,AnnotatedTypeMirror> toAtmMap()
-
mergeSubordinate
public void mergeSubordinate(InferenceResult subordinate)
Merges values in subordinate into this result, keeping the results form any type arguments that were already contained by this InferenceResult.- Parameters:
subordinate
- a result which we wish to merge into this result
-
mergeTarget
protected @Nullable InferredValue.InferredType mergeTarget(javax.lang.model.type.TypeVariable target, InferenceResult subordinate)
Performs a merge for a specific target, we keep only results that lead to a concrete type.
-
-