Class InitializationTransfer<V extends CFAbstractValue<V>,T extends InitializationTransfer<V,T,S>,S extends InitializationStore<V,S>>
java.lang.Object
org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<TransferResult<V,S>,TransferInput<V,S>>
org.checkerframework.framework.flow.CFAbstractTransfer<V,S,T>
org.checkerframework.checker.initialization.InitializationTransfer<V,T,S>
- Type Parameters:
V- the type of the abstract valueT- the type of the transfer functionS- the type of the store
- All Implemented Interfaces:
ForwardTransferFunction<V,,S> TransferFunction<V,,S> NodeVisitor<TransferResult<V,S>, TransferInput<V, S>>
- Direct Known Subclasses:
NullnessTransfer
public class InitializationTransfer<V extends CFAbstractValue<V>,T extends InitializationTransfer<V,T,S>,S extends InitializationStore<V,S>>
extends CFAbstractTransfer<V,S,T>
A transfer function that extends
CFAbstractTransfer and tracks InitializationStores. 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 non-null fields of the current class can safely be considered initialized. - After a method call with a postcondition that ensures a field to be non-null, that field
can safely be considered initialized (this is done in
CFAbstractStore.insertValue(JavaExpression, CFAbstractValue)). - All non-null fields with an initializer can be considered initialized (this is done in
CFAbstractStore.insertValue(JavaExpression, CFAbstractValue)). - After the call to a super constructor ("super()" call), all non-null fields of the super class can safely be considered initialized.
- See Also:
-
Field Summary
FieldsFields inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
analysis, sequentialSemantics -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<VariableElement> Returns the fields that can safely be considered initialized after the method callnode.protected booleanisNotFullyInitializedReceiver(MethodTree methodTree) Returns true if the receiver of a method or constructor might not yet be fully initialized.protected voidmarkInvariantFieldsAsInitialized(List<VariableElement> result, TypeElement clazzElem) Adds all the fields of the classclazzElemthat have the 'invariant annotation' to the set of initialized fieldsresult.visitAssignment(AssignmentNode n, TransferInput<V, S> in) If an invariant field is initialized and has the invariant annotation, then it has at least the invariant annotation.Methods inherited from class org.checkerframework.framework.flow.CFAbstractTransfer
addInformationFromPreconditions, createTransferResult, createTransferResult, finishValue, finishValue, getNarrowedValue, getValueFromFactory, getWidenedValue, initialStore, insertIntoStores, insertIntoStoresPermitNonDeterministic, moreSpecificValue, processCommonAssignment, processConditionalPostconditions, processPostconditions, recreateTransferResult, recreateTransferResult, setFixedInitialStore, shouldPerformWholeProgramInference, shouldPerformWholeProgramInference, splitAssignments, strengthenAnnotationOfEqualTo, usesSequentialSemantics, visitAnyPattern, visitArrayAccess, visitCase, visitClassName, visitConditionalNot, visitDeconstructorPattern, visitEqualTo, visitExpressionStatement, visitInstanceOf, visitLambdaResultExpression, visitLocalVariable, visitNarrowingConversion, visitNode, visitNotEqual, visitObjectCreation, visitReturn, visitStringConversion, visitSwitchExpressionNode, visitTernaryExpression, visitThis, visitVariableDeclaration, visitWideningConversionMethods 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, 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, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift
-
Field Details
-
atypeFactory
-
-
Constructor Details
-
InitializationTransfer
-
-
Method Details
-
isNotFullyInitializedReceiver
Description copied from class:CFAbstractTransferReturns true if the receiver of a method or constructor might not yet be fully initialized.- Overrides:
isNotFullyInitializedReceiverin classCFAbstractTransfer<V extends CFAbstractValue<V>,S extends InitializationStore<V, S>, T extends InitializationTransfer<V, T, S>> - Parameters:
methodTree- the declaration of the method or constructor- Returns:
- true if the receiver of a method or constructor might not yet be fully initialized
-
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
-
markInvariantFieldsAsInitialized
protected void markInvariantFieldsAsInitialized(List<VariableElement> result, TypeElement clazzElem) Adds all the fields of the classclazzElemthat have the 'invariant annotation' to the set of initialized fieldsresult. -
visitAssignment
- Specified by:
visitAssignmentin interfaceNodeVisitor<V extends CFAbstractValue<V>,T extends InitializationTransfer<V, T, S>> - Overrides:
visitAssignmentin classCFAbstractTransfer<V extends CFAbstractValue<V>,S extends InitializationStore<V, S>, T extends InitializationTransfer<V, T, S>>
-
visitFieldAccess
If an invariant field is initialized and has the invariant annotation, then it has at least the invariant annotation. Note that only fields of the 'this' receiver are tracked for initialization.- Specified by:
visitFieldAccessin interfaceNodeVisitor<V extends CFAbstractValue<V>,T extends InitializationTransfer<V, T, S>> - Overrides:
visitFieldAccessin classCFAbstractTransfer<V extends CFAbstractValue<V>,S extends InitializationStore<V, S>, T extends InitializationTransfer<V, T, S>>
-
visitMethodInvocation
- Specified by:
visitMethodInvocationin interfaceNodeVisitor<V extends CFAbstractValue<V>,T extends InitializationTransfer<V, T, S>> - Overrides:
visitMethodInvocationin classCFAbstractTransfer<V extends CFAbstractValue<V>,S extends InitializationStore<V, S>, T extends InitializationTransfer<V, T, S>>
-