Class LockTransfer
java.lang.Object
org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<TransferResult<CFValue,LockStore>,TransferInput<CFValue,LockStore>>
org.checkerframework.framework.flow.CFAbstractTransfer<CFValue,LockStore,LockTransfer>
org.checkerframework.checker.lock.LockTransfer
- All Implemented Interfaces:
ForwardTransferFunction<CFValue,,LockStore> TransferFunction<CFValue,,LockStore> NodeVisitor<TransferResult<CFValue,LockStore>, TransferInput<CFValue, LockStore>>
LockTransfer handles constructors, initializers, synchronized methods, and synchronized blocks.
-
Field Summary
Fields inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
aliasingAtfCache, aliasingAtfInitialized, analysis, assumeDeterministic, assumePureGetters, assumeSideEffectFree, sequentialSemantics -
Constructor Summary
ConstructorsConstructorDescriptionLockTransfer(LockAnalysis analysis, LockChecker checker) Create a transfer function for the Lock Checker. -
Method Summary
Modifier and TypeMethodDescriptioninitialStore(UnderlyingAST underlyingAST, List<LocalVariableNode> parameters) The initial store maps method formal parameters to their currently most refined type.protected voidmakeLockHeld(LockStore store, Node node) Sets a givenNodeto @LockHeld in the givenstore.protected voidmakeLockHeld(TransferResult<CFValue, LockStore> result, Node node) protected voidmakeLockPossiblyHeld(LockStore store, Node node) Sets a givenNodeto @LockPossiblyHeld in the givenstore.protected voidmakeLockPossiblyHeld(TransferResult<CFValue, LockStore> result, Node node) protected TransferResult<CFValue, LockStore> strengthenAnnotationOfEqualTo(TransferResult<CFValue, LockStore> res, Node firstNode, Node secondNode, CFValue firstValue, CFValue secondValue, boolean notEqualTo) Refine the annotation ofsecondNodeto the greatest lower bound offirstValueandsecondValue, if that is more precise thansecondValue.Methods inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
addInformationFromPreconditions, createTransferResult, createTransferResult, finishValue, finishValue, getNarrowedValue, getValueFromFactory, getWidenedValue, insertIntoStores, isNotFullyInitializedReceiver, moreSpecificValue, processCommonAssignment, processConditionalPostconditions, processPostconditions, recreateTransferResult, recreateTransferResult, setFixedInitialStore, splitAssignments, usesSequentialSemantics, visitAnyPattern, visitArrayAccess, visitAssignment, visitCase, visitClassName, visitConditionalNot, visitDeconstructorPattern, visitEqualTo, visitExpressionStatement, visitFieldAccess, visitInstanceOf, visitLambdaResultExpression, visitLocalVariable, visitMethodInvocation, visitNarrowingConversion, visitNode, visitNotEqual, visitObjectCreation, visitReturn, visitStringConversion, visitSwitchExpressionNode, visitTernaryExpression, visitThis, visitVariableDeclaration, visitWideningConversionMethods inherited from class org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor
visitArrayCreation, visitArrayType, visitAssertionError, visitBinaryComparisonOperation, visitBinaryConditionalOperation, visitBinaryNumericalOperation, visitBinaryOperation, 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, visitThrow, visitTypeCast, visitUnaryOperation, visitUnsignedRightShift, visitValueLiteralMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, visitThrow, visitTypeCast, visitUnsignedRightShift
-
Constructor Details
-
LockTransfer
Create a transfer function for the Lock Checker.- Parameters:
analysis- the analysis this transfer function belongs tochecker- the type-checker this transfer function belongs to
-
-
Method Details
-
makeLockHeld
Sets a givenNodeto @LockHeld in the givenstore.- Parameters:
store- the store to updatenode- the node that should be @LockHeld
-
makeLockPossiblyHeld
Sets a givenNodeto @LockPossiblyHeld in the givenstore.- Parameters:
store- the store to updatenode- the node that should be @LockPossiblyHeld
-
makeLockHeld
-
makeLockPossiblyHeld
-
strengthenAnnotationOfEqualTo
protected TransferResult<CFValue,LockStore> strengthenAnnotationOfEqualTo(TransferResult<CFValue, LockStore> res, Node firstNode, Node secondNode, CFValue firstValue, CFValue secondValue, boolean notEqualTo) Refine the annotation ofsecondNodeto the greatest lower bound offirstValueandsecondValue, if that is more precise thansecondValue. Its underlying type stays that ofsecondValue. This is possible, ifsecondNodeis an expression that is tracked by the store (e.g., a local variable or a field). Clients usually call this twice withfirstNodeandsecondNodereversed, to refine each of them.Note that when overriding this method, when a new type is inserted into the store,
CFAbstractTransfer.splitAssignments(org.checkerframework.dataflow.cfg.node.Node)should be called, and the new type should be inserted into the store for each of the resulting nodes.The Lock Checker does not refine either operand. Its qualifiers describe references, not objects: two references to the same object may be guarded by different locks, because the checker does not track aliasing, and only the exact expression used to acquire a lock is held. So a comparison of two expressions says nothing about the qualifiers of either.
- Overrides:
strengthenAnnotationOfEqualToin classCFAbstractTransfer<CFValue,LockStore, LockTransfer> - Parameters:
res- the previous resultfirstNode- the node thatsecondNodeis compared withsecondNode- the node whose type to possibly refinefirstValue- the abstract value offirstNodesecondValue- the abstract value ofsecondNodenotEqualTo- if true, indicates that the logic is flipped (i.e., the information is added to theelseStoreinstead of thethenStore) for a not-equal comparison- Returns:
- the conditional transfer result (if information has been added), or
res
-
initialStore
Description copied from class:CFAbstractTransferThe initial store maps method formal parameters to their currently most refined type.- Specified by:
initialStorein interfaceForwardTransferFunction<CFValue,LockStore> - Overrides:
initialStorein classCFAbstractTransfer<CFValue,LockStore, LockTransfer> - Parameters:
underlyingAST- an abstract syntax treeparameters- a list of local variable nodes representing formal parameters (if any)- Returns:
- the initial store
-
visitSynchronized
public TransferResult<CFValue,LockStore> visitSynchronized(SynchronizedNode n, TransferInput<CFValue, LockStore> p) - Specified by:
visitSynchronizedin interfaceNodeVisitor<TransferResult<CFValue,LockStore>, TransferInput<CFValue, LockStore>> - Overrides:
visitSynchronizedin classAbstractNodeVisitor<TransferResult<CFValue,LockStore>, TransferInput<CFValue, LockStore>>
-