Class HashcodeAtmVisitor

All Implemented Interfaces:
AnnotatedTypeVisitor<Void,Void>

public class HashcodeAtmVisitor extends SimpleAnnotatedTypeScanner<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:
  • Constructor Details

  • Method Details

    • compute

      public int compute(AnnotatedTypeMirror type)
      Computes and returns the hash of type.
      Parameters:
      type - the type to hash
      Returns:
      the hash code of type
    • reset

      public void reset()
      Description copied from class: AnnotatedTypeScanner
      Reset 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:
      reset in class AnnotatedTypeScanner<Void,Void>
    • defaultAction

      protected Void defaultAction(AnnotatedTypeMirror type, Void v)
      Hashes type using the underlying type and the primary annotation, accumulating into hash. This method does not descend into component types (this occurs in the scan method).
      Overrides:
      defaultAction in class SimpleAnnotatedTypeScanner<Void,Void>
      Parameters:
      type - the type
      v - unused
      Returns:
      unused