checkers.interning
Class InterningVisitor

java.lang.Object
  extended by com.sun.source.util.TreeScanner<R,P>
      extended by com.sun.source.util.TreePathScanner<R,P>
          extended by checkers.source.SourceVisitor<R,P>
              extended by checkers.basetype.BaseTypeVisitor<Void,Void>
                  extended by checkers.interning.InterningVisitor
All Implemented Interfaces:
TreeVisitor<Void,Void>

public final class InterningVisitor
extends BaseTypeVisitor<Void,Void>

A type-checking visitor for the Interned type qualifier that uses the BaseTypeVisitor implementation. This visitor reports errors or warnings for violations for the following cases:

  1. either argument to a "==" or "!=" comparison is not Interned (error "not.interned")
  2. the receiver and argument for a call to an equals method are both Interned (optional warning "unnecessary.equals")

See Also:
BaseTypeVisitor

Nested Class Summary
Modifier and Type Class and Description
 
Nested classes/interfaces inherited from class checkers.basetype.BaseTypeVisitor
BaseTypeVisitor.TypeValidator
 
Field Summary
Modifier and Type Field and Description
 
Fields inherited from class checkers.basetype.BaseTypeVisitor
annoFactory, annoTypes, checker, plainFactory, visitorState
 
Fields inherited from class checkers.source.SourceVisitor
atypeFactory, elements, root, trees, types
 
Constructor Summary
Constructor and Description
InterningVisitor(InterningChecker checker, CompilationUnitTree root)
          Creates a new visitor for type-checking Interned.
 
Method Summary
Modifier and Type Method and Description
 Void visitBinary(BinaryTree node, Void p)
           
 Void visitMethodInvocation(MethodInvocationTree node, Void p)
          Performs a method invocation check.
 
Methods inherited from class checkers.basetype.BaseTypeVisitor
checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConstructorInvocation, checkDefaultConstructor, checkMethodInvocability, checkOverride, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, isAccessAllowed, isVectorCopyInto, scan, shouldSkip, shouldSkip, typeCheckVectorCopyIntoArgument, validateTypeOf, visitAnnotation, visitAssignment, visitClass, visitCompilationUnit, visitCompoundAssignment, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitMethod, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitUnary, visitVariable
 
Methods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scan
 
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotatedType, visitArrayAccess, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitCatch, visitConditionalExpression, visitContinue, visitDisjointType, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeParameter, visitWhileLoop, visitWildcard
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterningVisitor

public InterningVisitor(InterningChecker checker,
                        CompilationUnitTree root)
Creates a new visitor for type-checking Interned.

Parameters:
checker - the checker to use
root - the root of the input program's AST to check
Method Detail

visitBinary

public Void visitBinary(BinaryTree node,
                        Void p)
Specified by:
visitBinary in interface TreeVisitor<Void,Void>
Overrides:
visitBinary in class TreeScanner<Void,Void>

visitMethodInvocation

public Void visitMethodInvocation(MethodInvocationTree node,
                                  Void p)
Description copied from class: BaseTypeVisitor
Performs a method invocation check. An invocation of a method, m, on the receiver, r is valid only if:

Specified by:
visitMethodInvocation in interface TreeVisitor<Void,Void>
Overrides:
visitMethodInvocation in class BaseTypeVisitor<Void,Void>