public class StructuralEqualityComparer extends AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
See also DefaultTypeHierarchy, and VisitHistory
Modifier and Type | Field and Description |
---|---|
protected SubtypeVisitHistory |
visitHistory |
Constructor and Description |
---|
StructuralEqualityComparer(SubtypeVisitHistory typeargVisitHistory) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
areAllEqual(java.util.Collection<? extends AnnotatedTypeMirror> types1,
java.util.Collection<? extends AnnotatedTypeMirror> types2)
Compare each type in types1 and types2 pairwise and return true if they are all equal.
|
boolean |
areEqualInHierarchy(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
javax.lang.model.element.AnnotationMirror top) |
protected boolean |
arePrimeAnnosEqual(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2)
Return true if type1 and type2 have the same set of annotations.
|
boolean |
boundsMatch(AnnotatedTypeMirror.AnnotatedTypeVariable type1,
AnnotatedTypeMirror.AnnotatedTypeVariable type2) |
protected boolean |
checkOrAreEqual(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2)
First check visitHistory to see if type1 and type2 have been compared once already.
|
protected java.lang.Boolean |
defaultAction(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
java.lang.Void p)
Called by the default implementation of every AbstractAtmComboVisitor visit method.
|
protected java.lang.String |
defaultErrorMessage(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
java.lang.Void p)
Called for every combination in which !type1.getClass().equals(type2.getClass()) except for
Wildcard_Typevar.
|
java.lang.Boolean |
visitArray_Array(AnnotatedTypeMirror.AnnotatedArrayType type1,
AnnotatedTypeMirror.AnnotatedArrayType type2,
java.lang.Void p)
Two arrays are equal if:
Their sets of primary annotations are equal, and
Their component types are equal
|
java.lang.Boolean |
visitDeclared_Declared(AnnotatedTypeMirror.AnnotatedDeclaredType type1,
AnnotatedTypeMirror.AnnotatedDeclaredType type2,
java.lang.Void p)
Two declared types are equal if:
The types are of the same class/interfaces
Their sets of primary annotations are equal
Their sets of type arguments are equal or one type is raw
|
java.lang.Boolean |
visitDeclared_Primitive(AnnotatedTypeMirror.AnnotatedDeclaredType type1,
AnnotatedTypeMirror.AnnotatedPrimitiveType type2,
java.lang.Void p) |
java.lang.Boolean |
visitDeclared_Typevar(AnnotatedTypeMirror.AnnotatedDeclaredType type1,
AnnotatedTypeMirror.AnnotatedTypeVariable type2,
java.lang.Void p) |
java.lang.Boolean |
visitIntersection_Intersection(AnnotatedTypeMirror.AnnotatedIntersectionType type1,
AnnotatedTypeMirror.AnnotatedIntersectionType type2,
java.lang.Void p)
//TODO: SHOULD PRIMARY ANNOTATIONS OVERRIDE INDIVIDUAL BOUND ANNOTATIONS? //TODO: IF SO THEN
WE SHOULD REMOVE THE arePrimeAnnosEqual AND FIX AnnotatedIntersectionType Two intersection
types are equal if:
Their sets of primary annotations are equal
Their sets of bounds (the types being intersected) are equal
|
java.lang.Boolean |
visitNull_Null(AnnotatedTypeMirror.AnnotatedNullType type1,
AnnotatedTypeMirror.AnnotatedNullType type2,
java.lang.Void p)
Two null types are equal if:
Their sets of primary annotations are equal
|
java.lang.Boolean |
visitNull_Typevar(AnnotatedTypeMirror.AnnotatedNullType type1,
AnnotatedTypeMirror.AnnotatedTypeVariable type2,
java.lang.Void p) |
java.lang.Boolean |
visitPrimitive_Declared(AnnotatedTypeMirror.AnnotatedPrimitiveType type1,
AnnotatedTypeMirror.AnnotatedDeclaredType type2,
java.lang.Void p) |
java.lang.Boolean |
visitPrimitive_Primitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type1,
AnnotatedTypeMirror.AnnotatedPrimitiveType type2,
java.lang.Void p)
Two primitive types are equal if:
Their sets of primary annotations are equal
|
protected java.lang.Boolean |
visitTypeArgs(AnnotatedTypeMirror.AnnotatedDeclaredType type1,
AnnotatedTypeMirror.AnnotatedDeclaredType type2)
A helper class for visitDeclared_Declared.
|
java.lang.Boolean |
visitTypevar_Declared(AnnotatedTypeMirror.AnnotatedTypeVariable type1,
AnnotatedTypeMirror.AnnotatedDeclaredType type2,
java.lang.Void p) |
java.lang.Boolean |
visitTypevar_Typevar(AnnotatedTypeMirror.AnnotatedTypeVariable type1,
AnnotatedTypeMirror.AnnotatedTypeVariable type2,
java.lang.Void p)
Two type variables are equal if:
Their bounds are equal
Note: Primary annotations will be taken into account when the bounds are retrieved
|
java.lang.Boolean |
visitTypevar_Wildcard(AnnotatedTypeMirror.AnnotatedTypeVariable type1,
AnnotatedTypeMirror.AnnotatedWildcardType type2,
java.lang.Void p) |
java.lang.Boolean |
visitWildcard_Declared(AnnotatedTypeMirror.AnnotatedWildcardType type1,
AnnotatedTypeMirror.AnnotatedDeclaredType type2,
java.lang.Void p) |
java.lang.Boolean |
visitWildcard_Typevar(AnnotatedTypeMirror.AnnotatedWildcardType type1,
AnnotatedTypeMirror.AnnotatedTypeVariable type2,
java.lang.Void p)
Since the Checker Framework doesn't engage in capture conversion, and since sometimes type
variables are "inferred" to be wildcards, this method allows the comparison of a wildcard to
a type variable even though they should never truly be equal.
|
java.lang.Boolean |
visitWildcard_Wildcard(AnnotatedTypeMirror.AnnotatedWildcardType type1,
AnnotatedTypeMirror.AnnotatedWildcardType type2,
java.lang.Void p)
Two wildcards are equal if:
Their bounds are equal
Note: Primary annotations will be taken into account when the bounds are retrieved
|
visit, visitArray_Declared, visitArray_Executable, visitArray_Intersection, visitArray_None, visitArray_Null, visitArray_Primitive, visitArray_Typevar, visitArray_Union, visitArray_Wildcard, visitDeclared_Array, visitDeclared_Executable, visitDeclared_Intersection, visitDeclared_None, visitDeclared_Null, visitDeclared_Union, visitDeclared_Wildcard, visitExecutable_Array, visitExecutable_Declared, visitExecutable_Executable, visitExecutable_Intersection, visitExecutable_None, visitExecutable_Null, visitExecutable_Primitive, visitExecutable_Typevar, visitExecutable_Union, visitExecutable_Wildcard, visitIntersection_Array, visitIntersection_Declared, visitIntersection_Executable, visitIntersection_None, visitIntersection_Null, visitIntersection_Primitive, visitIntersection_Typevar, visitIntersection_Union, visitIntersection_Wildcard, visitNone_Array, visitNone_Declared, visitNone_Executable, visitNone_Intersection, visitNone_None, visitNone_Null, visitNone_Primitive, visitNone_Union, visitNone_Wildcard, visitNull_Array, visitNull_Declared, visitNull_Executable, visitNull_Intersection, visitNull_None, visitNull_Primitive, visitNull_Union, visitNull_Wildcard, visitPrimitive_Array, visitPrimitive_Executable, visitPrimitive_Intersection, visitPrimitive_None, visitPrimitive_Null, visitPrimitive_Typevar, visitPrimitive_Union, visitPrimitive_Wildcard, visitTypevar_Array, visitTypevar_Executable, visitTypevar_Intersection, visitTypevar_None, visitTypevar_Null, visitTypevar_Primitive, visitTypevar_Union, visitUnion_Array, visitUnion_Declared, visitUnion_Executable, visitUnion_Intersection, visitUnion_None, visitUnion_Null, visitUnion_Primitive, visitUnion_Typevar, visitUnion_Union, visitUnion_Wildcard, visitWildcard_Array, visitWildcard_Executable, visitWildcard_Intersection, visitWildcard_None, visitWildcard_Null, visitWildcard_Primitive, visitWildcard_Union
protected final SubtypeVisitHistory visitHistory
public StructuralEqualityComparer(SubtypeVisitHistory typeargVisitHistory)
protected java.lang.Boolean defaultAction(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.lang.Void p)
AbstractAtmComboVisitor
defaultAction
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
type1
- the first AnnotatedTypeMirror parameter to the visit method calledtype2
- the second AnnotatedTypeMirror parameter to the visit method calledp
- subtype specific parameter passed to every visit methodpublic boolean areEqualInHierarchy(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, javax.lang.model.element.AnnotationMirror top)
protected boolean arePrimeAnnosEqual(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
protected boolean areAllEqual(java.util.Collection<? extends AnnotatedTypeMirror> types1, java.util.Collection<? extends AnnotatedTypeMirror> types2)
protected boolean checkOrAreEqual(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
protected java.lang.String defaultErrorMessage(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.lang.Void p)
defaultErrorMessage
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
type1
- the first AnnotatedTypeMirror parameter to the visit method calledtype2
- the second AnnotatedTypeMirror parameter to the visit method calledp
- subtype specific parameter passed to every visit methodpublic java.lang.Boolean visitArray_Array(AnnotatedTypeMirror.AnnotatedArrayType type1, AnnotatedTypeMirror.AnnotatedArrayType type2, java.lang.Void p)
visitArray_Array
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitArray_Array
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitDeclared_Declared(AnnotatedTypeMirror.AnnotatedDeclaredType type1, AnnotatedTypeMirror.AnnotatedDeclaredType type2, java.lang.Void p)
visitDeclared_Declared
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitDeclared_Declared
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
protected java.lang.Boolean visitTypeArgs(AnnotatedTypeMirror.AnnotatedDeclaredType type1, AnnotatedTypeMirror.AnnotatedDeclaredType type2)
public java.lang.Boolean visitIntersection_Intersection(AnnotatedTypeMirror.AnnotatedIntersectionType type1, AnnotatedTypeMirror.AnnotatedIntersectionType type2, java.lang.Void p)
visitIntersection_Intersection
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitIntersection_Intersection
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitNull_Null(AnnotatedTypeMirror.AnnotatedNullType type1, AnnotatedTypeMirror.AnnotatedNullType type2, java.lang.Void p)
visitNull_Null
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitNull_Null
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitPrimitive_Primitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type1, AnnotatedTypeMirror.AnnotatedPrimitiveType type2, java.lang.Void p)
visitPrimitive_Primitive
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitPrimitive_Primitive
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitTypevar_Typevar(AnnotatedTypeMirror.AnnotatedTypeVariable type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2, java.lang.Void p)
visitTypevar_Typevar
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitTypevar_Typevar
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public boolean boundsMatch(AnnotatedTypeMirror.AnnotatedTypeVariable type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2)
public java.lang.Boolean visitWildcard_Wildcard(AnnotatedTypeMirror.AnnotatedWildcardType type1, AnnotatedTypeMirror.AnnotatedWildcardType type2, java.lang.Void p)
TODO: IDENTIFY TESTS THAT LEAD TO RECURSIVE BOUNDED WILDCARDS, PERHAPS THE RIGHT THING IS TO MOVE THE CODE THAT IDENTIFIES REFERENCES TO THE SAME WILDCARD TYPE HERE. WOULD WE EVER WANT TO HAVE A REFERENCE TO THE SAME WILDCARD WITH DIFFERENT ANNOTATIONS?
visitWildcard_Wildcard
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitWildcard_Wildcard
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitDeclared_Primitive(AnnotatedTypeMirror.AnnotatedDeclaredType type1, AnnotatedTypeMirror.AnnotatedPrimitiveType type2, java.lang.Void p)
visitDeclared_Primitive
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitDeclared_Primitive
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitPrimitive_Declared(AnnotatedTypeMirror.AnnotatedPrimitiveType type1, AnnotatedTypeMirror.AnnotatedDeclaredType type2, java.lang.Void p)
visitPrimitive_Declared
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitPrimitive_Declared
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitWildcard_Typevar(AnnotatedTypeMirror.AnnotatedWildcardType type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2, java.lang.Void p)
A wildcard is equal to a type variable if:
visitWildcard_Typevar
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitWildcard_Typevar
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitWildcard_Declared(AnnotatedTypeMirror.AnnotatedWildcardType type1, AnnotatedTypeMirror.AnnotatedDeclaredType type2, java.lang.Void p)
visitWildcard_Declared
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitWildcard_Declared
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitTypevar_Declared(AnnotatedTypeMirror.AnnotatedTypeVariable type1, AnnotatedTypeMirror.AnnotatedDeclaredType type2, java.lang.Void p)
visitTypevar_Declared
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitTypevar_Declared
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitTypevar_Wildcard(AnnotatedTypeMirror.AnnotatedTypeVariable type1, AnnotatedTypeMirror.AnnotatedWildcardType type2, java.lang.Void p)
visitTypevar_Wildcard
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitTypevar_Wildcard
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitDeclared_Typevar(AnnotatedTypeMirror.AnnotatedDeclaredType type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2, java.lang.Void p)
visitDeclared_Typevar
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitDeclared_Typevar
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>
public java.lang.Boolean visitNull_Typevar(AnnotatedTypeMirror.AnnotatedNullType type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2, java.lang.Void p)
visitNull_Typevar
in interface AtmComboVisitor<java.lang.Boolean,java.lang.Void>
visitNull_Typevar
in class AbstractAtmComboVisitor<java.lang.Boolean,java.lang.Void>