Class CalledMethodsVisitor
java.lang.Object
com.sun.source.util.TreeScanner<Void,Void>
com.sun.source.util.TreePathScanner<Void,Void>
org.checkerframework.framework.source.SourceVisitor<Void,Void>
org.checkerframework.common.basetype.BaseTypeVisitor<AccumulationAnnotatedTypeFactory>
org.checkerframework.common.accumulation.AccumulationVisitor
org.checkerframework.checker.calledmethods.CalledMethodsVisitor
- All Implemented Interfaces:
TreeVisitor<Void,Void>
- Direct Known Subclasses:
RLCCalledMethodsVisitor
This visitor implements the custom error message "finalizer.invocation". It also supports
counting the number of framework build calls.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
BaseTypeVisitor.OverrideChecker -
Field Summary
Fields inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
assumePureGetters, atypeFactory, checker, DETERMINISTIC, IMPURE, methodTree, positions, PURE, qualHierarchy, showchecks, SIDE_EFFECT_FREE, slowTypecheckingSeconds, slowTypecheckingTree, TARGET, targetValueElement, typeHierarchy, typeValidator, unusedWhenElement, warnRedundantAnnotationsFields inherited from class org.checkerframework.framework.source.SourceVisitor
elements, root, trees, treesWithSuppressWarnings, types -
Constructor Summary
ConstructorsConstructorDescriptionCalledMethodsVisitor(BaseTypeChecker checker) Creates a new CalledMethodsVisitor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCheck if the given postcondition is really ensured by the body of the given method.voidprocessMethodTree(String className, MethodTree tree) Type-check methodTree.protected voidreportMethodInvocabilityError(MethodInvocationTree tree, AnnotatedTypeMirror found, AnnotatedTypeMirror expected) Turns some "method.invocation" errors into "finalizer.invocation" errors.visitAnnotation(AnnotationTree tree, Void p) Issue an error at every EnsuresCalledMethodsVarargs annotation, because using it is unsound.Performs a method invocation check.Methods inherited from class org.checkerframework.common.basetype.BaseTypeVisitor
checkAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, checkConstructorInvocation, checkConstructorResult, checkContract, checkDefaultConstructor, checkExceptionParameter, checkExplicitAnnotationsOnIntersectionBounds, checkExtendsAndImplements, checkExtendsOrImplements, checkFieldInvariantDeclarations, checkMethodInvocability, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkPurityAnnotations, checkQualifierParameter, checkSuperConstructorCall, checkThisConstructorCall, checkThisOrSuperConstructorCall, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckStartDiagnostic, contractExpressionAndType, createOverrideChecker, createTypeFactory, createTypeFactoryPublic, createTypeValidator, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isTypeCastSafe, isValidUse, isValidUse, isValidUse, processClassTree, reportPurityErrors, scan, setRoot, shouldPerformContractInference, shouldSkipUses, shouldWarnAboutIrrelevantJavaTypes, skipReceiverSubtypeCheck, testAnnotationInsertion, testJointJavacJavaParserVisitor, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotatedType, visitAnnotatedType, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitMethod, visitNewArray, visitNewClass, visitReturn, visitSwitchExpression17, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypes, warnInvalidPolymorphicQualifier, warnInvalidPolymorphicQualifier, warnRedundantAnnotationsMethods inherited from class org.checkerframework.framework.source.SourceVisitor
visitMethods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scanMethods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitConstantCaseLabel, visitContinue, visitDeconstructionPattern, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitStringTemplate, visitSwitch, visitSwitchExpression, visitSynchronized, visitTry, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
-
Constructor Details
-
CalledMethodsVisitor
Creates a new CalledMethodsVisitor.- Parameters:
checker- the type-checker associated with this visitor
-
-
Method Details
-
visitAnnotation
Issue an error at every EnsuresCalledMethodsVarargs annotation, because using it is unsound.- Specified by:
visitAnnotationin interfaceTreeVisitor<Void,Void> - Overrides:
visitAnnotationin classAccumulationVisitor
-
processMethodTree
Description copied from class:BaseTypeVisitorType-check methodTree. Subclasses should override this method instead ofBaseTypeVisitor.visitMethod(MethodTree, Void).- Overrides:
processMethodTreein classBaseTypeVisitor<AccumulationAnnotatedTypeFactory>- Parameters:
className- the class that contains the method, for diagnostics onlytree- the method to type-check
-
checkExceptionalPostcondition
protected void checkExceptionalPostcondition(EnsuresCalledMethodOnExceptionContract postcond, MethodTree tree) Check if the given postcondition is really ensured by the body of the given method.- Parameters:
postcond- the postcondition to checktree- the method
-
visitMethodInvocation
Description copied from class:BaseTypeVisitorPerforms 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:
visitMethodInvocationin interfaceTreeVisitor<Void,Void> - Overrides:
visitMethodInvocationin classBaseTypeVisitor<AccumulationAnnotatedTypeFactory>
-
reportMethodInvocabilityError
protected void reportMethodInvocabilityError(MethodInvocationTree tree, AnnotatedTypeMirror found, AnnotatedTypeMirror expected) Turns some "method.invocation" errors into "finalizer.invocation" errors.- Overrides:
reportMethodInvocabilityErrorin classBaseTypeVisitor<AccumulationAnnotatedTypeFactory>- Parameters:
tree- the AST node at which to report the errorfound- the actual type of the receiverexpected- the expected type of the receiver
-