public abstract class TypeFlow<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected AnalysisContext |
context |
protected AnalysisType |
declaredType |
protected MethodFlowsGraph |
graphRef |
protected int |
id |
boolean |
inQueue |
protected static AtomicInteger |
nextId |
protected T |
source |
protected boolean |
usedAsAParameter
True if this flow is passed as a parameter to a call.
|
protected boolean |
usedAsAReceiver
True if this flow is the receiver of a virtual call.
|
| Constructor and Description |
|---|
TypeFlow() |
TypeFlow(T source,
AnalysisType declaredType) |
TypeFlow(T source,
AnalysisType declaredType,
boolean canBeNull) |
TypeFlow(T source,
AnalysisType declaredType,
TypeState state) |
TypeFlow(TypeFlow<T> original,
MethodFlowsGraph graphRef)
Shallow copy constructor.
|
TypeFlow(TypeState typeState) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInput(TypeFlow<?> input) |
void |
addObservee(TypeFlow<?> observee) |
void |
addObserver(PointsToAnalysis bb,
TypeFlow<?> observer)
Register object that will be notified when the state of this flow changes.
|
boolean |
addOriginalObserver(PointsToAnalysis bb,
TypeFlow<?> observer)
Adds an observer, if not already present, without triggering update.
|
boolean |
addOriginalUse(PointsToAnalysis bb,
TypeFlow<?> use)
Adds a use, if not already present, without propagating state.
|
boolean |
addState(PointsToAnalysis bb,
TypeState add) |
boolean |
addState(PointsToAnalysis bb,
TypeState add,
boolean postFlow) |
boolean |
addUse(PointsToAnalysis bb,
TypeFlow<?> use) |
boolean |
canSaturate()
Can this type flow saturate? By default all type flows can saturate, with the exception of a
few ones that need to track all their types, e.g., AllInstantiated, AllSynchronized, etc.
|
AnalysisContext |
context() |
TypeFlow<T> |
copy(PointsToAnalysis bb,
MethodFlowsGraph methodFlows)
By default a type flow is not cloneable.
|
TypeState |
declaredTypeFilter(PointsToAnalysis bb,
TypeState newState)
Filter type states using a flow's declared type.
|
protected boolean |
doAddUse(PointsToAnalysis bb,
TypeFlow<?> use,
boolean registerInput) |
boolean |
equals(Object other) |
TypeState |
filter(PointsToAnalysis bb,
TypeState newState) |
String |
format(boolean withState,
boolean withSource) |
String |
formatSource() |
AnalysisType |
getDeclaredType() |
Collection<TypeFlow<?>> |
getInputs() |
Collection<TypeFlow<?>> |
getObservees() |
Collection<TypeFlow<?>> |
getObservers() |
int |
getSlot() |
T |
getSource() |
TypeState |
getState() |
Collection<TypeFlow<?>> |
getUses() |
MethodFlowsGraph |
graphRef() |
int |
hashCode() |
int |
id() |
void |
initClone(PointsToAnalysis bb)
Initialization code for some clone corner case type flows.
|
boolean |
isAllInstantiated() |
boolean |
isClone() |
boolean |
isSaturated()
Return true if this flow is saturated.
|
boolean |
isUsedAsAParameter() |
boolean |
isUsedAsAReceiver() |
AnalysisMethod |
method() |
protected void |
notifyObserverOfSaturation(PointsToAnalysis bb,
TypeFlow<?> observer) |
protected void |
notifyObservers(PointsToAnalysis bb)
Let the observers know that the state has changed.
|
protected void |
notifyUseOfSaturation(PointsToAnalysis bb,
TypeFlow<?> use) |
protected void |
onInputSaturated(PointsToAnalysis bb,
TypeFlow<?> input)
Notified by an input that it is saturated and it will stop sending updates.
|
void |
onObservedSaturated(PointsToAnalysis bb,
TypeFlow<?> observed)
Notified by an observed flow that it is saturated.
|
void |
onObservedUpdate(PointsToAnalysis bb)
Notify the observer that the observed type flow state has changed.
|
protected void |
onSaturated(PointsToAnalysis bb)
Called when this type flow becomes saturated.
|
TypeFlow<?> |
receiver()
Some flows have a receiver (e.g., loads, store and invokes).
|
boolean |
removeInput(TypeFlow<?> input) |
boolean |
removeObservee(TypeFlow<?> observee) |
boolean |
removeObserver(TypeFlow<?> observer) |
boolean |
removeUse(TypeFlow<?> use) |
void |
replacedObservedWith(PointsToAnalysis bb,
TypeFlow<?> newObservedFlow) |
void |
replaceObservedWith(PointsToAnalysis bb,
AnalysisType newObservedType)
When an "observed -> observer" link is updated the observer needs to be notified as well so
it can update its internal reference.
|
protected void |
setObserved(TypeFlow<?> newObservedFlow)
Set the type flow that this flow is observing.
|
void |
setSaturated()
Mark this flow as saturated.
|
void |
setSlot(int slot) |
void |
setState(PointsToAnalysis bb,
TypeState state) |
void |
setUsedAsAParameter(boolean usedAsAParameter) |
void |
setUsedAsAReceiver(boolean usedAsAReceiver) |
protected void |
swapAtObserver(PointsToAnalysis bb,
TypeFlow<?> newFlow,
TypeFlow<?> observer) |
protected void |
swapAtUse(PointsToAnalysis bb,
TypeFlow<?> newFlow,
TypeFlow<?> use) |
protected void |
swapOut(PointsToAnalysis bb,
TypeFlow<?> newFlow)
This flow will swap itself out at all uses and observers.
|
String |
toString() |
void |
update(PointsToAnalysis bb) |
protected static final AtomicInteger nextId
protected final int id
protected final T source
protected final AnalysisType declaredType
protected final MethodFlowsGraph graphRef
protected final AnalysisContext context
protected boolean usedAsAParameter
protected boolean usedAsAReceiver
public volatile boolean inQueue
public TypeFlow()
public TypeFlow(TypeState typeState)
public TypeFlow(T source, AnalysisType declaredType)
public TypeFlow(T source, AnalysisType declaredType, boolean canBeNull)
public TypeFlow(T source, AnalysisType declaredType, TypeState state)
public TypeFlow(TypeFlow<T> original, MethodFlowsGraph graphRef)
original - the original flowgraphRef - the holder method clonepublic TypeFlow<T> copy(PointsToAnalysis bb, MethodFlowsGraph methodFlows)
bb - methodFlows - public void initClone(PointsToAnalysis bb)
bb - public void setUsedAsAParameter(boolean usedAsAParameter)
public boolean isUsedAsAParameter()
public void setUsedAsAReceiver(boolean usedAsAReceiver)
public boolean isUsedAsAReceiver()
public TypeFlow<?> receiver()
public int id()
public AnalysisContext context()
public MethodFlowsGraph graphRef()
public AnalysisMethod method()
public T getSource()
public boolean isClone()
public AnalysisType getDeclaredType()
public TypeState getState()
public boolean isAllInstantiated()
public void setState(PointsToAnalysis bb, TypeState state)
public void setSlot(int slot)
public int getSlot()
public boolean isSaturated()
public boolean canSaturate()
public void setSaturated()
public boolean addState(PointsToAnalysis bb, TypeState add)
public boolean addState(PointsToAnalysis bb, TypeState add, boolean postFlow)
public boolean addOriginalUse(PointsToAnalysis bb, TypeFlow<?> use)
public boolean addUse(PointsToAnalysis bb, TypeFlow<?> use)
protected void notifyUseOfSaturation(PointsToAnalysis bb, TypeFlow<?> use)
protected boolean doAddUse(PointsToAnalysis bb, TypeFlow<?> use, boolean registerInput)
public boolean removeUse(TypeFlow<?> use)
public Collection<TypeFlow<?>> getUses()
public boolean addOriginalObserver(PointsToAnalysis bb, TypeFlow<?> observer)
public void addObserver(PointsToAnalysis bb, TypeFlow<?> observer)
protected void notifyObserverOfSaturation(PointsToAnalysis bb, TypeFlow<?> observer)
public boolean removeObserver(TypeFlow<?> observer)
public Collection<TypeFlow<?>> getObservers()
protected void notifyObservers(PointsToAnalysis bb)
public void addObservee(TypeFlow<?> observee)
public Collection<TypeFlow<?>> getObservees()
public boolean removeObservee(TypeFlow<?> observee)
public void addInput(TypeFlow<?> input)
public Collection<TypeFlow<?>> getInputs()
public boolean removeInput(TypeFlow<?> input)
public TypeState filter(PointsToAnalysis bb, TypeState newState)
public TypeState declaredTypeFilter(PointsToAnalysis bb, TypeState newState)
public void update(PointsToAnalysis bb)
public void onObservedUpdate(PointsToAnalysis bb)
protected void onSaturated(PointsToAnalysis bb)
protected void swapOut(PointsToAnalysis bb, TypeFlow<?> newFlow)
protected void swapAtUse(PointsToAnalysis bb, TypeFlow<?> newFlow, TypeFlow<?> use)
protected void swapAtObserver(PointsToAnalysis bb, TypeFlow<?> newFlow, TypeFlow<?> observer)
protected void onInputSaturated(PointsToAnalysis bb, TypeFlow<?> input)
public void onObservedSaturated(PointsToAnalysis bb, TypeFlow<?> observed)
public void replaceObservedWith(PointsToAnalysis bb, AnalysisType newObservedType)
TypeFlow.replacedObservedWith(PointsToAnalysis, TypeFlow) can be used for
replacing the observed with a custom type flow.public void replacedObservedWith(PointsToAnalysis bb, TypeFlow<?> newObservedFlow)
protected void setObserved(TypeFlow<?> newObservedFlow)
public String formatSource()
public String format(boolean withState, boolean withSource)