Class RLCCalledMethodsVisitor
- All Implemented Interfaces:
TreeVisitor<Void,Void>
Owning fields are satisfied, and for checking that CreatesMustCallFor overrides are
valid.-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RLCCalledMethodsAnnotatedTypeFactoryConstructs an instance of the appropriate type factory for the implemented type system.getCreatesMustCallForValues(ExecutableElement elt, MustCallAnnotatedTypeFactory mcAtf, RLCCalledMethodsAnnotatedTypeFactory atypeFactory) Returns all theCreatesMustCallFor.value()elements/arguments of all @CreatesMustCallFor annotations on the given element.protected booleanChecks if WPI is enabled for the Resource Leak Checker inference.voidprocessMethodTree(String className, MethodTree tree) Type-check methodTree.protected booleanShould Whole Program Inference attempt to infer contract annotations? Typically, the answer is "yes" whenever WPI is enabled, but this method exists to allow subclasses to customize that behavior.visitVariable(VariableTree tree, Void p) Methods inherited from class org.checkerframework.checker.calledmethods.CalledMethodsVisitor
checkExceptionalPostcondition, reportMethodInvocabilityError, visitAnnotation, visitMethodInvocationMethods 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, createTypeFactoryPublic, createTypeValidator, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isTypeCastSafe, isValidUse, isValidUse, isValidUse, processClassTree, reportPurityErrors, scan, setRoot, 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, 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
-
RLCCalledMethodsVisitor
Create the visitor.- Parameters:
checker- the type-checker associated with this visitor
-
-
Method Details
-
createTypeFactory
Description copied from class:BaseTypeVisitorConstructs an instance of the appropriate type factory for the implemented type system.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.
- Overrides:
createTypeFactoryin classBaseTypeVisitor<AccumulationAnnotatedTypeFactory>- Returns:
- the appropriate type factory
-
processMethodTree
Description copied from class:BaseTypeVisitorType-check methodTree. Subclasses should override this method instead ofBaseTypeVisitor.visitMethod(MethodTree, Void).- Overrides:
processMethodTreein classCalledMethodsVisitor- Parameters:
className- the class that contains the method, for diagnostics onlytree- the method to type-check
-
shouldPerformContractInference
protected boolean shouldPerformContractInference()Description copied from class:BaseTypeVisitorShould Whole Program Inference attempt to infer contract annotations? Typically, the answer is "yes" whenever WPI is enabled, but this method exists to allow subclasses to customize that behavior.- Overrides:
shouldPerformContractInferencein classBaseTypeVisitor<AccumulationAnnotatedTypeFactory>- Returns:
- true if contract inference should be performed, false if it should be disabled (even when WPI is enabled)
-
getCreatesMustCallForValues
public static List<String> getCreatesMustCallForValues(ExecutableElement elt, MustCallAnnotatedTypeFactory mcAtf, RLCCalledMethodsAnnotatedTypeFactory atypeFactory) Returns all theCreatesMustCallFor.value()elements/arguments of all @CreatesMustCallFor annotations on the given element.Does no viewpoint-adaptation, unlike
CreatesMustCallForToJavaExpression.getCreatesMustCallForExpressionsAtInvocation(org.checkerframework.dataflow.cfg.node.MethodInvocationNode, org.checkerframework.framework.type.GenericAnnotatedTypeFactory<?, ?, ?, ?>, org.checkerframework.checker.mustcall.CreatesMustCallForElementSupplier)which does.- Parameters:
elt- an executable elementmcAtf- a MustCallAnnotatedTypeFactory, to source the value elementatypeFactory- a RLCCalledMethodsAnnotatedTypeFactory- Returns:
- the literal strings present in the @CreatesMustCallFor annotation(s) of that element, substituting the default "this" for empty annotations. This method returns the empty list iff there are no @CreatesMustCallFor annotations on elt. The returned list is always modifiable if it is non-empty.
-
visitVariable
- Specified by:
visitVariablein interfaceTreeVisitor<Void,Void> - Overrides:
visitVariablein classBaseTypeVisitor<AccumulationAnnotatedTypeFactory>
-
isWpiEnabledForRLC
protected boolean isWpiEnabledForRLC()Checks if WPI is enabled for the Resource Leak Checker inference. SeeResourceLeakChecker.ENABLE_WPI_FOR_RLC.- Returns:
- returns true if WPI is enabled for the Resource Leak Checker
-