checkers.interning
Class InterningVisitor
java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
checkers.source.SourceVisitor<R,P>
checkers.basetype.BaseTypeVisitor<Void,Void>
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:
- either argument to a "==" or "!=" comparison is not Interned (error
"not.interned")
- the receiver and argument for a call to an equals method are both
Interned (optional warning "unnecessary.equals")
- See Also:
BaseTypeVisitor
Methods inherited from class checkers.basetype.BaseTypeVisitor |
checkArguments, checkArrayInitialization, checkAssignability, checkConstructorInvocation, checkMethodInvocability, checkOverride, checkTypeArguments, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, scan, shouldSkip, shouldSkip, validateTypeOf, visitAnnotation, visitAssignment, visitClass, visitCompilationUnit, visitCompoundAssignment, visitEnhancedForLoop, visitInstanceOf, visitMethod, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitUnary, visitVariable |
Methods inherited from class com.sun.source.util.TreeScanner |
reduce, scan, visitAnnotatedType, visitArrayAccess, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitCatch, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, 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 |
InterningVisitor
public InterningVisitor(InterningChecker checker,
CompilationUnitTree root)
- Creates a new visitor for type-checking
Interned
.
- Parameters:
checker
- the checker to useroot
- the root of the input program's AST to check
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:
- passed arguments are subtypes of corresponding m parameters
- r is a subtype of m receiver type
- if m is generic, passed type arguments are subtypes
of m type variables
-
- Specified by:
visitMethodInvocation
in interface TreeVisitor<Void,Void>
- Overrides:
visitMethodInvocation
in class BaseTypeVisitor<Void,Void>