public abstract class AFConstraint extends Object
Modifier and Type | Field and Description |
---|---|
AnnotatedTypeMirror |
argument |
AnnotatedTypeMirror |
formalParameter |
protected int |
hashcodeBase
Used to compute hashcodes.
|
Constructor and Description |
---|
AFConstraint(AnnotatedTypeMirror argument,
AnnotatedTypeMirror formalParameter,
int hashcodeBase) |
Modifier and Type | Method and Description |
---|---|
protected abstract AFConstraint |
construct(AnnotatedTypeMirror newArgument,
AnnotatedTypeMirror newFormalParameter)
Used to create a new constraint of the same subclass of AFConstraint.
|
boolean |
equals(Object thatObject) |
int |
hashCode() |
boolean |
isIrreducible(Set<TypeVariable> targets) |
AFConstraint |
substitute(Map<TypeVariable,AnnotatedTypeMirror> substitutions)
Given a partial solution to our type argument inference, replace any uses of type parameters that
have been solved with their arguments.
|
abstract TUConstraint |
toTUConstraint()
Once AFConstraints are irreducible it can be converted to a TU constraint, constraints between
individual type parameters for which we are inferring an argument (T) and Java types (U).
|
public final AnnotatedTypeMirror argument
public final AnnotatedTypeMirror formalParameter
protected final int hashcodeBase
public AFConstraint(AnnotatedTypeMirror argument, AnnotatedTypeMirror formalParameter, int hashcodeBase)
public boolean isIrreducible(Set<TypeVariable> targets)
targets
- the type parameters whose arguments we are trying to solve forpublic abstract TUConstraint toTUConstraint()
public AFConstraint substitute(Map<TypeVariable,AnnotatedTypeMirror> substitutions)
(T0 -> A0, T1 -> A1, ..., TN -> AN)
where Ti is a type parameter and Ai is its solved argument.
For all uses of Ti in this constraint, replace them with Ai.
For the mapping (T0 -> A0)
, the following constraint:
ArrayList<T0> << List<T1>
Becomes:
ArrayList<A0> << List<T1>
A constraint:
T0 << T1
Becomes:
A0 << T1
substitutions
- a mapping of target type parameter to the type argument toprotected abstract AFConstraint construct(AnnotatedTypeMirror newArgument, AnnotatedTypeMirror newFormalParameter)