public class ReportVisitor extends BaseTypeVisitor<BaseAnnotatedTypeFactory>
Modifier and Type | Class and Description |
---|---|
protected class |
ReportVisitor.ReportTypeValidator |
BaseTypeVisitor.OverrideChecker
atypeFactory, checker, contractsUtils, positions, typeValidator, visitorState
elements, root, trees, types
Constructor and Description |
---|
ReportVisitor(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
protected BaseAnnotatedTypeFactory |
createTypeFactory()
Constructs an instance of the appropriate type factory for the implemented type system.
|
protected BaseTypeValidator |
createTypeValidator() |
void |
processClassTree(com.sun.source.tree.ClassTree node)
Type-check classTree.
|
java.lang.Void |
scan(com.sun.source.tree.Tree tree,
java.lang.Void p) |
java.lang.Void |
visitArrayAccess(com.sun.source.tree.ArrayAccessTree node,
java.lang.Void p) |
java.lang.Void |
visitAssignment(com.sun.source.tree.AssignmentTree node,
java.lang.Void p)
Performs two checks: subtyping and assignability checks, using
BaseTypeVisitor.commonAssignmentCheck(Tree, ExpressionTree, String) . |
java.lang.Void |
visitIdentifier(com.sun.source.tree.IdentifierTree node,
java.lang.Void p) |
java.lang.Void |
visitInstanceOf(com.sun.source.tree.InstanceOfTree node,
java.lang.Void p) |
java.lang.Void |
visitMemberSelect(com.sun.source.tree.MemberSelectTree node,
java.lang.Void p) |
java.lang.Void |
visitMethod(com.sun.source.tree.MethodTree node,
java.lang.Void p)
Performs pseudo-assignment check: checks that the method obeys override and subtype rules to
all overridden methods.
|
java.lang.Void |
visitMethodInvocation(com.sun.source.tree.MethodInvocationTree node,
java.lang.Void p)
Performs a method invocation check.
|
java.lang.Void |
visitModifiers(com.sun.source.tree.ModifiersTree node,
java.lang.Void p) |
java.lang.Void |
visitNewArray(com.sun.source.tree.NewArrayTree node,
java.lang.Void p) |
java.lang.Void |
visitNewClass(com.sun.source.tree.NewClassTree node,
java.lang.Void p)
Performs a new class invocation check.
|
java.lang.Void |
visitTypeCast(com.sun.source.tree.TypeCastTree node,
java.lang.Void p) |
checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkFieldInvariantDeclarations, checkForAnnotatedJdk, checkMethodInvocability, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createOverrideChecker, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isAccessAllowed, isAssignable, isValidUse, isValidUse, isValidUse, isVectorCopyInto, reportPurityErrors, setRoot, shouldSkipUses, skipReceiverSubtypeCheck, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotation, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitLambdaExpression, visitMemberReference, visitParameterizedType, visitReturn, visitThrow, visitTry, visitTypeParameter, visitUnary, visitVariable
visit
reduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBinary, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitUnionType, visitWhileLoop, visitWildcard
public ReportVisitor(BaseTypeChecker checker)
protected BaseAnnotatedTypeFactory createTypeFactory()
BaseTypeVisitor
The default implementation uses the checker naming convention to create the appropriate
type factory. If no factory is found, it returns BaseAnnotatedTypeFactory
. It
reflectively invokes the constructor that accepts this checker and compilation unit tree (in
that order) as arguments.
Subclasses have to override this method to create the appropriate visitor if they do not follow the checker naming convention.
createTypeFactory
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void scan(com.sun.source.tree.Tree tree, java.lang.Void p)
scan
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public void processClassTree(com.sun.source.tree.ClassTree node)
BaseTypeVisitor
BaseTypeVisitor.visitClass(ClassTree, Void)
.processClassTree
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
node
- class to checkpublic java.lang.Void visitMethod(com.sun.source.tree.MethodTree node, java.lang.Void p)
BaseTypeVisitor
The override rule specifies that a method, m1, may override a method m2 only if:
visitMethod
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitMethod
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitMethodInvocation(com.sun.source.tree.MethodInvocationTree node, java.lang.Void p)
BaseTypeVisitor
An invocation of a method, m, on the receiver, r is valid only if:
visitMethodInvocation
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitMethodInvocation
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitMemberSelect(com.sun.source.tree.MemberSelectTree node, java.lang.Void p)
visitMemberSelect
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitMemberSelect
in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitIdentifier(com.sun.source.tree.IdentifierTree node, java.lang.Void p)
visitIdentifier
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitIdentifier
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitAssignment(com.sun.source.tree.AssignmentTree node, java.lang.Void p)
BaseTypeVisitor
BaseTypeVisitor.commonAssignmentCheck(Tree, ExpressionTree, String)
.
If the subtype check fails, it issues a "assignment.type.incompatible" error.
visitAssignment
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitAssignment
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitArrayAccess(com.sun.source.tree.ArrayAccessTree node, java.lang.Void p)
visitArrayAccess
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitArrayAccess
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitNewClass(com.sun.source.tree.NewClassTree node, java.lang.Void p)
BaseTypeVisitor
An invocation of a constructor, c, is valid only if:
visitNewClass
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitNewClass
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitNewArray(com.sun.source.tree.NewArrayTree node, java.lang.Void p)
visitNewArray
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitNewArray
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitTypeCast(com.sun.source.tree.TypeCastTree node, java.lang.Void p)
visitTypeCast
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitTypeCast
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitInstanceOf(com.sun.source.tree.InstanceOfTree node, java.lang.Void p)
visitInstanceOf
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitInstanceOf
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>
public java.lang.Void visitModifiers(com.sun.source.tree.ModifiersTree node, java.lang.Void p)
visitModifiers
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>
visitModifiers
in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
protected BaseTypeValidator createTypeValidator()
createTypeValidator
in class BaseTypeVisitor<BaseAnnotatedTypeFactory>