Class InitializationTransfer
java.lang.Object
org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<TransferResult<CFValue,InitializationStore>,TransferInput<CFValue,InitializationStore>>
org.checkerframework.framework.flow.CFAbstractTransfer<CFValue,InitializationStore,InitializationTransfer>
org.checkerframework.checker.initialization.InitializationTransfer
- All Implemented Interfaces:
ForwardTransferFunction<CFValue,
,InitializationStore> TransferFunction<CFValue,
,InitializationStore> NodeVisitor<TransferResult<CFValue,
InitializationStore>, TransferInput<CFValue, InitializationStore>>
public class InitializationTransfer
extends CFAbstractTransfer<CFValue,InitializationStore,InitializationTransfer>
A transfer function that extends
CFAbstractTransfer
and tracks InitializationStore
s. In addition to the features of CFAbstractTransfer
, this transfer
function also tracks which fields of the current class ('self' receiver) have been initialized.
More precisely, the following refinements are performed:
- After the call to a constructor ("this()" call), all fields of the current class can safely be considered initialized.
- After the call to a super constructor ("super()" call), all fields of the super class can safely be considered initialized.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final InitializationParentAnnotatedTypeFactory
The initialization type factoryFields inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
analysis, sequentialSemantics
-
Constructor Summary
ConstructorDescriptionInitializationTransfer
(InitializationAnalysis analysis) Create a new InitializationTransfer for the given analysis. -
Method Summary
Modifier and TypeMethodDescriptionprotected List
<VariableElement> Returns the fields that can safely be considered initialized after the method callnode
.protected void
markFieldsAsInitialized
(List<VariableElement> result, TypeElement clazzElem) Adds all the fields of the classclazzElem
to the list of initialized fieldsresult
.Methods inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
addInformationFromPreconditions, createTransferResult, finishValue, finishValue, getNarrowedValue, getValueFromFactory, getWidenedValue, initialStore, insertIntoStores, isNotFullyInitializedReceiver, moreSpecificValue, processCommonAssignment, processConditionalPostconditions, processPostconditions, recreateTransferResult, setFixedInitialStore, splitAssignments, strengthenAnnotationOfEqualTo, usesSequentialSemantics, visitArrayAccess, visitCase, visitClassName, visitConditionalNot, visitDeconstructorPattern, 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
-
Field Details
-
atypeFactory
The initialization type factory
-
-
Constructor Details
-
InitializationTransfer
Create a new InitializationTransfer for the given analysis.- Parameters:
analysis
- init analysi.s
-
-
Method Details
-
initializedFieldsAfterCall
Returns the fields that can safely be considered initialized after the method callnode
.- Parameters:
node
- a method call- Returns:
- the fields that are initialized after the method call
-
markFieldsAsInitialized
Adds all the fields of the classclazzElem
to the list of initialized fieldsresult
.- Parameters:
result
- the list of initialized fieldsclazzElem
- the class whose fields to add
-
visitAssignment
public TransferResult<CFValue,InitializationStore> visitAssignment(AssignmentNode n, TransferInput<CFValue, InitializationStore> in) - Specified by:
visitAssignment
in interfaceNodeVisitor<TransferResult<CFValue,
InitializationStore>, TransferInput<CFValue, InitializationStore>> - Overrides:
visitAssignment
in classCFAbstractTransfer<CFValue,
InitializationStore, InitializationTransfer>
-
visitMethodInvocation
public TransferResult<CFValue,InitializationStore> visitMethodInvocation(MethodInvocationNode n, TransferInput<CFValue, InitializationStore> in) - Specified by:
visitMethodInvocation
in interfaceNodeVisitor<TransferResult<CFValue,
InitializationStore>, TransferInput<CFValue, InitializationStore>> - Overrides:
visitMethodInvocation
in classCFAbstractTransfer<CFValue,
InitializationStore, InitializationTransfer>
-