Class AliasingTransfer
java.lang.Object
org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<TransferResult<V,S>,TransferInput<V,S>>
org.checkerframework.framework.flow.CFAbstractTransfer<CFValue,CFStore,CFTransfer>
org.checkerframework.framework.flow.CFTransfer
org.checkerframework.common.aliasing.AliasingTransfer
- All Implemented Interfaces:
ForwardTransferFunction<CFValue,
,CFStore> TransferFunction<CFValue,
,CFStore> NodeVisitor<TransferResult<CFValue,
CFStore>, TransferInput<CFValue, CFStore>>
Type refinement is treated in the usual way, except that at (pseudo-)assignments the RHS may lose
its type refinement, before the LHS is type-refined.
The RHS always loses its type refinement (it is widened to @MaybeAliased, and its declared type must have been @MaybeAliased) except in the following cases:
- The RHS is a fresh expression.
- The LHS is a @NonLeaked formal parameter and the RHS is an argument in a method call or constructor invocation.
- The LHS is a @LeakedToResult formal parameter, the RHS is an argument in a method call or constructor invocation, and the method's return value is discarded.
-
Field Summary
Fields inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
analysis, sequentialSemantics
-
Constructor Summary
ConstructorsConstructorDescriptionAliasingTransfer
(CFAbstractAnalysis<CFValue, CFStore, CFTransfer> analysis) Create a new AliasingTransfer. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
processPostconditions
(Node n, CFStore store, ExecutableElement executableElement, ExpressionTree tree) Handling pseudo-assignments.Case 1: For every assignment, the LHS is refined if the RHS has type @Unique and is a method invocation or a new class instance.Case 3: Given a method invocation expression, if the parent of the expression is not a statement, check if there are any arguments of the method call annotated as @LeakedToResult and remove it from the store, since it might be leaked.Methods inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
addInformationFromPreconditions, createTransferResult, finishValue, finishValue, getNarrowedValue, getValueFromFactory, getWidenedValue, initialStore, insertIntoStores, isNotFullyInitializedReceiver, moreSpecificValue, processCommonAssignment, processConditionalPostconditions, recreateTransferResult, setFixedInitialStore, splitAssignments, strengthenAnnotationOfEqualTo, usesSequentialSemantics, visitArrayAccess, visitCase, visitClassName, visitConditionalNot, visitEqualTo, visitExpressionStatement, visitFieldAccess, visitInstanceOf, visitLambdaResultExpression, visitLocalVariable, visitNarrowingConversion, visitNode, visitNotEqual, visitObjectCreation, visitReturn, visitStringConversion, visitSwitchExpressionNode, visitTernaryExpression, visitThis, visitVariableDeclaration, visitWideningConversion
Methods inherited from class org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThis, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitGreaterThan, visitGreaterThanOrEqual, visitImplicitThis, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLessThan, visitLessThanOrEqual, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalAddition, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitNumericalSubtraction, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift, visitValueLiteral
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.checkerframework.dataflow.cfg.node.NodeVisitor
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThis, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitGreaterThan, visitGreaterThanOrEqual, visitImplicitThis, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLessThan, visitLessThanOrEqual, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalAddition, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitNumericalSubtraction, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift
-
Constructor Details
-
AliasingTransfer
Create a new AliasingTransfer.- Parameters:
analysis
- the CFAbstractAnalysis
-
-
Method Details
-
visitAssignment
public TransferResult<CFValue,CFStore> visitAssignment(AssignmentNode n, TransferInput<CFValue, CFStore> in) Case 1: For every assignment, the LHS is refined if the RHS has type @Unique and is a method invocation or a new class instance.- Specified by:
visitAssignment
in interfaceNodeVisitor<TransferResult<CFValue,
CFStore>, TransferInput<CFValue, CFStore>> - Overrides:
visitAssignment
in classCFAbstractTransfer<CFValue,
CFStore, CFTransfer>
-
processPostconditions
protected void processPostconditions(Node n, CFStore store, ExecutableElement executableElement, ExpressionTree tree) Handling pseudo-assignments. Called byCFAbstractTransfer.visitMethodInvocation()
.Case 2: Given a method call, traverses all formal parameters of the method declaration, and if it doesn't have the @NonLeaked or @LeakedToResult annotations, we remove the node of the respective argument in the method call from the store. If parameter has @LeakedToResult,
visitMethodInvocation()
handles it.- Overrides:
processPostconditions
in classCFAbstractTransfer<CFValue,
CFStore, CFTransfer> - Parameters:
n
- a method call or an object creationstore
- a store; is side-effected by this methodexecutableElement
- the method or constructor being calledtree
- the tree for the method call or the object creation
-
visitMethodInvocation
public TransferResult<CFValue,CFStore> visitMethodInvocation(MethodInvocationNode n, TransferInput<CFValue, CFStore> in) Case 3: Given a method invocation expression, if the parent of the expression is not a statement, check if there are any arguments of the method call annotated as @LeakedToResult and remove it from the store, since it might be leaked.- Specified by:
visitMethodInvocation
in interfaceNodeVisitor<TransferResult<CFValue,
CFStore>, TransferInput<CFValue, CFStore>> - Overrides:
visitMethodInvocation
in classCFAbstractTransfer<CFValue,
CFStore, CFTransfer>
-