Class EqualityAtmComparer
java.lang.Object
org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor<RETURN_TYPE,PARAM>
org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner<Boolean,Void>
org.checkerframework.framework.type.EqualityAtmComparer
- All Implemented Interfaces:
AtmComboVisitor<Boolean,
Void>
Compares two annotated type mirrors for structural equality using only the primary annotations
and underlying types of the two input types and their component types. Note, this leaves out
other fields specific to some AnnotatedTypeMirrors (like directSupertypes, isUnderlyingTypeRaw,
isUninferredTypeArgument etc...). Ideally, both EqualityAtmComparer and HashcodeAtmVisitor would
visit relevant fields.
This class is used by AnnotatedTypeMirror#equals
This class should be kept synchronized with HashcodeAtmVisitor.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner
EquivalentAtmComboScanner.Visited
-
Field Summary
Fields inherited from class org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner
visited
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
arePrimeAnnosEqual
(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) Return true if type1 and type2 have equivalent sets of annotations.protected boolean
compare
(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) Return true if the twe types are the same.protected String
defaultErrorMessage
(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, Void v) Called when a visit method is called on two types that do not have the same class, i.e.protected Boolean
Used to combine the results from component types or a type and its component types.protected Boolean
scan
(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, Void v) protected Boolean
scanWithNull
(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, Void aVoid) In an AnnotatedTypeScanner a null type is encounter than null is returned.Methods inherited from class org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner
scan, scanAndReduce, scanAndReduce, visit, visitArray_Array, visitDeclared_Declared, visitExecutable_Executable, visitIntersection_Intersection, visitNone_None, visitNull_Null, visitPrimitive_Primitive, visitTypevar_Typevar, visitUnion_Union, visitWildcard_Wildcard
Methods inherited from class org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor
defaultAction, 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_Primitive, visitDeclared_Typevar, visitDeclared_Union, visitDeclared_Wildcard, visitExecutable_Array, visitExecutable_Declared, 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_Null, visitNone_Primitive, visitNone_Union, visitNone_Wildcard, visitNull_Array, visitNull_Declared, visitNull_Executable, visitNull_Intersection, visitNull_None, visitNull_Primitive, visitNull_Typevar, visitNull_Union, visitNull_Wildcard, visitPrimitive_Array, visitPrimitive_Declared, visitPrimitive_Executable, visitPrimitive_Intersection, visitPrimitive_None, visitPrimitive_Null, visitPrimitive_Typevar, visitPrimitive_Union, visitPrimitive_Wildcard, visitTypevar_Array, visitTypevar_Declared, visitTypevar_Executable, visitTypevar_Intersection, visitTypevar_None, visitTypevar_Null, visitTypevar_Primitive, visitTypevar_Union, visitTypevar_Wildcard, visitUnion_Array, visitUnion_Declared, visitUnion_Executable, visitUnion_Intersection, visitUnion_None, visitUnion_Null, visitUnion_Primitive, visitUnion_Typevar, visitUnion_Wildcard, visitWildcard_Array, visitWildcard_Declared, visitWildcard_Executable, visitWildcard_Intersection, visitWildcard_None, visitWildcard_Null, visitWildcard_Primitive, visitWildcard_Typevar, visitWildcard_Union
-
Constructor Details
-
EqualityAtmComparer
public EqualityAtmComparer()
-
-
Method Details
-
defaultErrorMessage
Called when a visit method is called on two types that do not have the same class, i.e. when !type1.getClass().equals(type2.getClass())- Specified by:
defaultErrorMessage
in classAbstractAtmComboVisitor<Boolean,
Void> - Parameters:
type1
- the first AnnotatedTypeMirror parameter to the visit method calledtype2
- the second AnnotatedTypeMirror parameter to the visit method calledv
- subtype specific parameter passed to every visit method- Returns:
- an error message
-
arePrimeAnnosEqual
Return true if type1 and type2 have equivalent sets of annotations. -
compare
Return true if the twe types are the same.- Parameters:
type1
- the first type to comparetype2
- the second type to compare- Returns:
- true if the twe types are the same
-
scanWithNull
Description copied from class:EquivalentAtmComboScanner
In an AnnotatedTypeScanner a null type is encounter than null is returned. A user may want to customize the behavior of this scanner depending on whether or not one or both types is null.- Specified by:
scanWithNull
in classEquivalentAtmComboScanner<Boolean,
Void> - Parameters:
type1
- a nullable AnnotatedTypeMirrortype2
- a nullable AnnotatedTypeMirroraVoid
- the visitor param- Returns:
- a subclass specific return type/value
-
scan
- Overrides:
scan
in classEquivalentAtmComboScanner<Boolean,
Void>
-
reduce
Used to combine the results from component types or a type and its component types.- Overrides:
reduce
in classEquivalentAtmComboScanner<Boolean,
Void>
-