Class InitializationStore
java.lang.Object
org.checkerframework.framework.flow.CFAbstractStore<CFValue,InitializationStore>
org.checkerframework.checker.initialization.InitializationStore
- All Implemented Interfaces:
Store<InitializationStore>,org.plumelib.util.UniqueId
A store that extends
CFAbstractStore and additionally tracks which fields of the 'self'
reference have been initialized.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.checkerframework.dataflow.analysis.Store
Store.FlowRule, Store.Kind -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Set<VariableElement> The set of fields that are initialized.protected booleanWhetherinitializedFieldsis shared with another store.Fields inherited from class org.checkerframework.framework.flow.CFAbstractStore
analysis, arrayValues, classValues, fieldValues, localVariableValues, methodCallExpressions, sequentialSemantics, thisValue -
Constructor Summary
ConstructorsConstructorDescriptionInitializationStore(InitializationAnalysis analysis, boolean sequentialSemantics) Creates a new InitializationStore.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidMark the field identified by the elementfas initialized (the caller needs to ensure that the field belongs to the current class, or is a static field).voidaddInitializedField(FieldAccess field) Mark the field identified by the elementfieldas initialized if it belongs to the current class, or is static (in which case there is no aliasing issue and we can just add all static fields).copy()Returns an exact copy of this store.booleanReturns true if this is equal to the given argument.Returns the analysis associated with this store.inthashCode()voidinsertValue(JavaExpression je, CFValue value, boolean permitImpure) protected StringAdds a representation of the internal information of this Store to visualizerviz.booleanIs the field identified by the elementfinitialized?Computes the least upper bound (LUB) of this store and another store.protected booleanReturns true iff thisCFAbstractStorecontains a superset of the map entries of the argumentCFAbstractStore.Methods inherited from class org.checkerframework.framework.flow.CFAbstractStore
canAlias, canInsertJavaExpression, clearValue, computeNewValueAndInsert, getFieldValue, getFieldValues, getUid, getValue, getValue, getValue, getValue, getValue, getValue, initializeMethodParameter, initializeThisValue, insertOrRefine, insertOrRefine, insertThisValue, insertValue, insertValue, insertValuePermitImpure, insertValuePermitImpure, isMonotonicUpdate, newFieldValueAfterMethodCall, newMonotonicFieldValueAfterMethodCall, removeConflicting, removeConflicting, removeConflicting, replaceValue, replaceValue, shouldInsert, toString, updateForArrayAssignment, updateForAssignment, updateForFieldAccessAssignment, updateForLocalVariableAssignment, updateForMethodCall, visualize, widenedUpperBoundMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.plumelib.util.UniqueId
getClassAndUid
-
Field Details
-
initializedFields
The set of fields that are initialized.
-
-
Constructor Details
-
InitializationStore
Creates a new InitializationStore.- Parameters:
analysis- the analysis class this store belongs tosequentialSemantics- should the analysis use sequential Java semantics?
-
InitializationStore
Copy constructor.- Parameters:
other- the store to copy
-
-
Method Details
-
insertValue
Helper method forCFAbstractStore.insertValue(JavaExpression, CFAbstractValue)andCFAbstractStore.insertValuePermitImpure(org.checkerframework.dataflow.expression.JavaExpression, javax.lang.model.element.AnnotationMirror).Every overriding implementation should start with
if (!shouldInsert) { return; }If the receiver is a field, and has an invariant annotation, then it can be considered initialized.
- Overrides:
insertValuein classCFAbstractStore<CFValue,InitializationStore> - Parameters:
je- the expression to insert in the storevalue- the value of the expressionpermitImpure- if false, does nothing ifexpris impure; if true, permits impure expressions to be placed in the store
-
copy
Description copied from interface:StoreReturns an exact copy of this store.- Specified by:
copyin interfaceStore<InitializationStore>- Overrides:
copyin classCFAbstractStore<CFValue,InitializationStore> - Returns:
- an exact copy of this store
-
addInitializedField
Mark the field identified by the elementfieldas initialized if it belongs to the current class, or is static (in which case there is no aliasing issue and we can just add all static fields).- Parameters:
field- a field that is initialized
-
addInitializedField
Mark the field identified by the elementfas initialized (the caller needs to ensure that the field belongs to the current class, or is a static field).- Parameters:
f- a field that is initialized
-
isFieldInitialized
Is the field identified by the elementfinitialized? -
supersetOf
Description copied from class:CFAbstractStoreReturns true iff thisCFAbstractStorecontains a superset of the map entries of the argumentCFAbstractStore. Note that we test the entry keys and values by Java equality, not by any subtype relationship. This method is used primarily to simplify the equals predicate.- Overrides:
supersetOfin classCFAbstractStore<CFValue,InitializationStore> - Parameters:
o- the other store- Returns:
- true iff this store contains a superset of the map entries in the other store
-
equals
Description copied from interface:StoreReturns true if this is equal to the given argument.- Specified by:
equalsin interfaceStore<InitializationStore>- Overrides:
equalsin classCFAbstractStore<CFValue,InitializationStore> - Parameters:
o- the object to compare against this- Returns:
- true if this is equal to the given argument
-
hashCode
public int hashCode()- Overrides:
hashCodein classCFAbstractStore<CFValue,InitializationStore>
-
leastUpperBound
Description copied from class:CFAbstractStoreComputes the least upper bound (LUB) of this store and another store. The LUB represents a program state that is true if either this store or the other store is true.- Specified by:
leastUpperBoundin interfaceStore<InitializationStore>- Overrides:
leastUpperBoundin classCFAbstractStore<CFValue,InitializationStore> - Parameters:
other- the store to merge with this one- Returns:
- a new store that represents the LUB of this store and the other
-
internalVisualize
Description copied from class:CFAbstractStoreAdds a representation of the internal information of this Store to visualizerviz.- Overrides:
internalVisualizein classCFAbstractStore<CFValue,InitializationStore> - Parameters:
viz- the visualizer- Returns:
- a representation of the internal information of this
Store
-
getAnalysis
Returns the analysis associated with this store.- Returns:
- the analysis associated with this store
-