checkers.types
Class TypeAnnotator

java.lang.Object
  extended by checkers.types.visitors.AnnotatedTypeScanner<Void,ElementKind>
      extended by checkers.types.TypeAnnotator
All Implemented Interfaces:
AnnotatedTypeVisitor<Void,ElementKind>

public class TypeAnnotator
extends AnnotatedTypeScanner<Void,ElementKind>

Adds annotations to a type based on the contents of a type. By default, this class honors the ImplicitFor annotation and applies implicit annotations specified by ImplicitFor for any type whose visitor is not overridden or does not call super; it is designed to be invoked from AnnotatedTypeFactory.annotateImplicit(Element, AnnotatedTypeMirror) and AnnotatedTypeFactory.annotateImplicit(Tree, AnnotatedTypeMirror).

TypeAnnotator traverses types deeply by default, except that it skips the method receiver of executable types (for interoperability with AnnotatedTypeFactory.annotateInheritedFromClass(AnnotatedTypeMirror)).


Field Summary
Modifier and Type Field and Description
 
Fields inherited from class checkers.types.visitors.AnnotatedTypeScanner
visitedNodes
 
Constructor Summary
Constructor and Description
TypeAnnotator(BaseTypeChecker checker)
          Creates a TypeAnnotator from the given checker, using that checker's TypeQualifiers annotation to determine the annotations that are in the type hierarchy.
 
Method Summary
Modifier and Type Method and Description
protected  Void scan(AnnotatedTypeMirror type, ElementKind p)
          Processes an element by calling e.accept(this, p); this method may be overridden by subclasses.
 Void visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType t, ElementKind p)
          Visits an executable type.
 
Methods inherited from class checkers.types.visitors.AnnotatedTypeScanner
reduce, scan, scanAndReduce, scanAndReduce, visit, visit, visitArray, visitDeclared, visitNoType, visitNull, visitPrimitive, visitTypeVariable, visitWildcard
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeAnnotator

public TypeAnnotator(BaseTypeChecker checker)
Creates a TypeAnnotator from the given checker, using that checker's TypeQualifiers annotation to determine the annotations that are in the type hierarchy.

Parameters:
checker - the type checker to which this annotator belongs
Method Detail

scan

protected Void scan(AnnotatedTypeMirror type,
                    ElementKind p)
Description copied from class: AnnotatedTypeScanner
Processes an element by calling e.accept(this, p); this method may be overridden by subclasses.

Overrides:
scan in class AnnotatedTypeScanner<Void,ElementKind>
Returns:
the result of visiting type

visitExecutable

public Void visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType t,
                            ElementKind p)
Description copied from interface: AnnotatedTypeVisitor
Visits an executable type.

Specified by:
visitExecutable in interface AnnotatedTypeVisitor<Void,ElementKind>
Overrides:
visitExecutable in class AnnotatedTypeScanner<Void,ElementKind>
Parameters:
t - the type to visit
p - a visitor-specified parameter
Returns:
a visitor-specified result