Class EqualityAtmComparer
- java.lang.Object
-
- org.checkerframework.framework.type.visitor.AbstractAtmComboVisitor<RETURN_TYPE,PARAM>
-
- org.checkerframework.framework.type.visitor.EquivalentAtmComboScanner<java.lang.Boolean,java.lang.Void>
-
- org.checkerframework.framework.type.EqualityAtmComparer
-
- All Implemented Interfaces:
AtmComboVisitor<java.lang.Boolean,java.lang.Void>
public class EqualityAtmComparer extends EquivalentAtmComboScanner<java.lang.Boolean,java.lang.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
Constructors Constructor Description EqualityAtmComparer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
arePrimeAnnosEqual(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
Return true iftype1
andtype2
have equivalent sets of annotations.protected boolean
compare(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
Return true if the twe types are the same.protected java.lang.Boolean
reduce(java.lang.Boolean r1, java.lang.Boolean r2)
Used to combine the results from component types or a type and its component types.protected java.lang.Boolean
scan(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.lang.Void v)
protected java.lang.Boolean
scanWithNull(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.lang.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
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.checkerframework.framework.type.visitor.AtmComboVisitor
defaultAction, defaultErrorMessage
-
-
-
-
Method Detail
-
arePrimeAnnosEqual
protected boolean arePrimeAnnosEqual(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
Return true iftype1
andtype2
have equivalent sets of annotations.- Parameters:
type1
- a typetype2
- a type- Returns:
- true if
type1
andtype2
have equivalent sets of annotations
-
compare
@EqualsMethod protected boolean compare(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2)
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
protected java.lang.Boolean scanWithNull(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.lang.Void aVoid)
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<java.lang.Boolean,java.lang.Void>
- Parameters:
type1
- a nullable AnnotatedTypeMirrortype2
- a nullable AnnotatedTypeMirroraVoid
- the visitor param- Returns:
- a subclass specific return type/value
-
scan
protected java.lang.Boolean scan(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.lang.Void v)
- Overrides:
scan
in classEquivalentAtmComboScanner<java.lang.Boolean,java.lang.Void>
-
reduce
protected java.lang.Boolean reduce(java.lang.Boolean r1, java.lang.Boolean r2)
Used to combine the results from component types or a type and its component types.- Overrides:
reduce
in classEquivalentAtmComboScanner<java.lang.Boolean,java.lang.Void>
-
-