checkers.fenum
Class FenumVisitor
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.fenum.FenumVisitor
- All Implemented Interfaces:
- TreeVisitor<Void,Void>
public class FenumVisitor
extends BaseTypeVisitor<Void,Void>
Method Summary
protected void |
checkArguments(List<? extends AnnotatedTypeMirror> requiredArgs,
List<? extends ExpressionTree> passedArgs,
Void p)
A helper method to check that each passed argument is a subtype of the
corresponding required argument, and issues "argument.invalid" error
for each passed argument that not a subtype of the required one. |
protected boolean |
checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
MethodInvocationTree node)
Tests whether the method can be invoked using the receiver of the 'node'
method invocation, and issues a "method.invocation.invalid" if the
invocation is invalid. |
Void |
visitAssignment(AssignmentTree node,
Void p)
Performs two checks: subtyping and assignability checks, using
BaseTypeVisitor.commonAssignmentCheck(Tree, ExpressionTree, String, Object). |
Void |
visitBinary(BinaryTree node,
Void p)
|
Void |
visitVariable(VariableTree node,
Void p)
|
| Methods inherited from class checkers.basetype.BaseTypeVisitor |
checkAccess, checkArrayInitialization, checkAssignability, checkConstructorInvocation, checkDefaultConstructor, checkOverride, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, isAccessAllowed, isVectorCopyInto, scan, shouldSkip, shouldSkip, typeCheckVectorCopyIntoArgument, validateTypeOf, visitAnnotation, visitClass, visitCompilationUnit, visitCompoundAssignment, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitUnary |
| 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 |
FenumVisitor
public FenumVisitor(FenumChecker checker,
CompilationUnitTree root)
visitBinary
public Void visitBinary(BinaryTree node,
Void p)
- Specified by:
visitBinary in interface TreeVisitor<Void,Void>
- Overrides:
visitBinary in class TreeScanner<Void,Void>
visitVariable
public Void visitVariable(VariableTree node,
Void p)
- Specified by:
visitVariable in interface TreeVisitor<Void,Void>
- Overrides:
visitVariable in class BaseTypeVisitor<Void,Void>
visitAssignment
public Void visitAssignment(AssignmentTree node,
Void p)
- Description copied from class:
BaseTypeVisitor
- Performs two checks: subtyping and assignability checks, using
BaseTypeVisitor.commonAssignmentCheck(Tree, ExpressionTree, String, Object).
If the subtype check fails, it issues a "assignment.type.incompatible" error.
- Specified by:
visitAssignment in interface TreeVisitor<Void,Void>
- Overrides:
visitAssignment in class BaseTypeVisitor<Void,Void>
checkArguments
protected void checkArguments(List<? extends AnnotatedTypeMirror> requiredArgs,
List<? extends ExpressionTree> passedArgs,
Void p)
- Description copied from class:
BaseTypeVisitor
- A helper method to check that each passed argument is a subtype of the
corresponding required argument, and issues "argument.invalid" error
for each passed argument that not a subtype of the required one.
Note this method requires the lists to have the same length, as it
does not handle cases like var args.
- Overrides:
checkArguments in class BaseTypeVisitor<Void,Void>
- Parameters:
requiredArgs - the required typespassedArgs - the expressions passed to the corresponding types
checkMethodInvocability
protected boolean checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
MethodInvocationTree node)
- Description copied from class:
BaseTypeVisitor
- Tests whether the method can be invoked using the receiver of the 'node'
method invocation, and issues a "method.invocation.invalid" if the
invocation is invalid.
This implementation tests whether the receiver in the method invocation
is a subtype of the method receiver type.
- Overrides:
checkMethodInvocability in class BaseTypeVisitor<Void,Void>
- Parameters:
method - the type of the invoked methodnode - the method invocation node
- Returns:
- true iff the call of 'node' is a valid call