public class VisitHistory extends Object
VisitHistory keeps track of all visits and allows clients of this class to check whether or not they have visited a pair of AnnotatedTypeMirrors already. This is necessary in order to halt visiting on recursive bounds. Normally, this could be done using a HashSet; this class is necessary because of two properties of wildcards:
AnnotatedWildcardType wc = ...
wc.getEffectiveSuperBound().equals(wc.getEffectiveSuperBound());
// the above line will return false if the super bound is a wildcard
// because two wildcards are .equals only if they are also referentially (==) equal
// and each call to getEffectiveSuperBound returns a copy of the original bound
Constructor and Description |
---|
VisitHistory() |
Modifier and Type | Method and Description |
---|---|
void |
add(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2)
Add a visit for type1 and type2.
|
void |
clear() |
boolean |
contains(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2)
Returns true if type1 and type2 (or an equivalent pair) have been passed to the add method
previously.
|
String |
toString() |
public void clear()
public void add(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
public boolean contains(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)