Class HashcodeAtmVisitor
java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<Void,Void>
org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner<Void,Void>
org.checkerframework.framework.type.HashcodeAtmVisitor
- All Implemented Interfaces:
AnnotatedTypeVisitor<Void,Void>
Computes the hashcode of an AnnotatedTypeMirror using the underlying type and primary annotations
and the hash code of component types of AnnotatedTypeMirror.
This class should be synchronized with EqualityAtmComparer.
The visitor accumulates into a mutable int field rather than returning Integer
through the scanner's reduce machinery. This avoids per-node Integer.valueOf boxing and
the lambda dispatch through reduceFunction, which together accounted for roughly 2.5% of
total CPU in profiling.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner
SimpleAnnotatedTypeScanner.DefaultAction<R,P> Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R> -
Field Summary
Fields inherited from class org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner
defaultActionFields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, VISITED_NODES_EXPECTED_MAX_SIZE, visitedNodes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompute(AnnotatedTypeMirror type) Computes and returns the hash oftype.protected VoiddefaultAction(AnnotatedTypeMirror type, Void v) Hashestypeusing the underlying type and the primary annotation, accumulating intohash.voidreset()Reset the scanner to allow reuse of the same instance.Methods inherited from class org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner
visitArray, visitDeclared, visitExecutable, visitNoType, visitNull, visitPrimitive, visitTypeVariable, visitWildcardMethods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, scan, scan, scanAndReduce, scanAndReduce, visit, visit, visitIntersection, visitUnion
-
Constructor Details
-
HashcodeAtmVisitor
public HashcodeAtmVisitor()Creates aHashcodeAtmVisitor.
-
-
Method Details
-
compute
Computes and returns the hash oftype.- Parameters:
type- the type to hash- Returns:
- the hash code of
type
-
reset
public void reset()Description copied from class:AnnotatedTypeScannerReset the scanner to allow reuse of the same instance. Subclasses should override this method to clear their additional state; they must call the super implementation.- Overrides:
resetin classAnnotatedTypeScanner<Void,Void>
-
defaultAction
Hashestypeusing the underlying type and the primary annotation, accumulating intohash. This method does not descend into component types (this occurs in the scan method).- Overrides:
defaultActionin classSimpleAnnotatedTypeScanner<Void,Void> - Parameters:
type- the typev- unused- Returns:
- unused
-