public class DfaMemoryStateImpl extends java.lang.Object implements DfaMemoryState
| Modifier | Constructor and Description |
|---|---|
protected |
DfaMemoryStateImpl(DfaMemoryStateImpl toCopy) |
protected |
DfaMemoryStateImpl(DfaValueFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterMerge(DfaMemoryStateImpl other)
Custom logic to be implemented by subclasses
|
boolean |
applyCondition(DfaCondition dfaCond) |
boolean |
applyContractCondition(DfaCondition condition) |
boolean |
areEqual(DfaValue value1,
DfaValue value2)
Returns true if given two values are known to be equal
|
boolean |
checkNotNullable(DfaValue value) |
DfaMemoryStateImpl |
createClosureState() |
DfaMemoryStateImpl |
createCopy() |
protected com.intellij.codeInspection.dataFlow.DfaVariableState |
createVariableState(DfaVariableValue var) |
void |
emptyStack() |
boolean |
equals(java.lang.Object obj) |
protected DfType |
filterDfTypeOnAssignment(DfaVariableValue var,
DfType dfType) |
void |
flushFields() |
void |
flushVariable(DfaVariableValue variable) |
protected void |
flushVariable(DfaVariableValue variable,
boolean shouldMarkFlushed) |
LongRangeSet |
getBinOpRange(DfaBinOpValue binOp) |
DfType |
getDfType(DfaValue value) |
DfaValueFactory |
getFactory() |
PsiType |
getPsiType(DfaValue value) |
RelationType |
getRelation(DfaValue left,
DfaValue right)
Returns a relation between given values within this state, if known
|
DfaValue |
getStackValue(int offset)
Reads a value from the stack at given offset from the top without popping it
|
DfType |
getUnboxedDfType(DfaValue value) |
int |
hashCode() |
boolean |
isEmptyStack() |
boolean |
isEphemeral() |
boolean |
isNotNull(DfaValue dfaVar) |
boolean |
isNull(DfaValue dfaValue) |
boolean |
isSuperStateOf(DfaMemoryStateImpl that)
Returns true if current state describes all possible concrete program states described by
that state. |
void |
markEphemeral()
Ephemeral means a state that was created when considering a method contract and checking if one of its arguments is null.
|
boolean |
meetDfType(DfaValue value,
DfType dfType)
Updates value dfType if it's compatible with current value state.
|
DfaValue |
peek()
Reads a value from the top of the stack without popping it
|
DfaValue |
pop()
Pops single value from the top of the stack and returns it
|
void |
push(DfaValue value)
Pushes given value to the stack
|
void |
setDfType(DfaValue value,
DfType dfType)
Forcibly sets the supplied dfType to given value if given value state can be memoized.
|
void |
setVarValue(DfaVariableValue var,
DfaValue value) |
boolean |
shouldCompareByEquals(DfaValue dfaLeft,
DfaValue dfaRight)
Returns true if two given values should be compared by content, rather than by reference.
|
java.lang.String |
toString() |
protected void |
updateEquivalentVariables(DfaVariableValue dfaVar,
com.intellij.codeInspection.dataFlow.DfaVariableState state) |
protected DfaMemoryStateImpl(DfaValueFactory factory)
protected DfaMemoryStateImpl(DfaMemoryStateImpl toCopy)
public DfaValueFactory getFactory()
public DfaMemoryStateImpl createCopy()
createCopy in interface DfaMemoryStatepublic DfaMemoryStateImpl createClosureState()
createClosureState in interface DfaMemoryStatepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic DfaValue pop()
DfaMemoryStatepop in interface DfaMemoryStatepublic DfaValue peek()
DfaMemoryStatepeek in interface DfaMemoryStatepublic DfaValue getStackValue(int offset)
DfaMemoryStategetStackValue in interface DfaMemoryStateoffset - value from the stack (0 = top of stack, 1 = the next one, etc.)public void push(DfaValue value)
DfaMemoryStatepush in interface DfaMemoryStatevalue - to pushpublic void emptyStack()
emptyStack in interface DfaMemoryStatepublic void setVarValue(DfaVariableValue var, DfaValue value)
setVarValue in interface DfaMemoryStateprotected DfType filterDfTypeOnAssignment(DfaVariableValue var, DfType dfType)
public boolean isSuperStateOf(DfaMemoryStateImpl that)
that state.that - a sub-state candidatepublic boolean shouldCompareByEquals(DfaValue dfaLeft, DfaValue dfaRight)
DfaMemoryStateshouldCompareByEquals in interface DfaMemoryStatedfaLeft - left valuedfaRight - right valuepublic boolean isNull(DfaValue dfaValue)
isNull in interface DfaMemoryStatepublic boolean isNotNull(DfaValue dfaVar)
isNotNull in interface DfaMemoryStatepublic void markEphemeral()
DfaMemoryStatemarkEphemeral in interface DfaMemoryStatepublic boolean isEphemeral()
isEphemeral in interface DfaMemoryStatepublic boolean isEmptyStack()
isEmptyStack in interface DfaMemoryStatepublic void setDfType(DfaValue value, DfType dfType)
DfaMemoryStateDfaMemoryState.meetDfType(DfaValue, DfType) should be used as it narrows existing type.setDfType in interface DfaMemoryStatevalue - value to update.dfType - type to assign to value. Note that type might be adjusted, e.g. to be compatible with value declared PsiType.public boolean meetDfType(DfaValue value, DfType dfType)
DfaMemoryStatemeetDfType in interface DfaMemoryStatevalue - value to updatedfType - wanted typepublic boolean applyContractCondition(DfaCondition condition)
applyContractCondition in interface DfaMemoryStatepublic boolean areEqual(DfaValue value1, DfaValue value2)
DfaMemoryStateareEqual in interface DfaMemoryStatevalue1 - first value to checkvalue2 - second value to checkpublic RelationType getRelation(DfaValue left, DfaValue right)
DfaMemoryStategetRelation in interface DfaMemoryStateleft - first valueright - second valuepublic boolean applyCondition(DfaCondition dfaCond)
applyCondition in interface DfaMemoryStatepublic PsiType getPsiType(DfaValue value)
getPsiType in interface DfaMemoryStatevalue - value to get the type ofpublic boolean checkNotNullable(DfaValue value)
checkNotNullable in interface DfaMemoryStatepublic LongRangeSet getBinOpRange(DfaBinOpValue binOp)
public DfType getUnboxedDfType(DfaValue value)
getUnboxedDfType in interface DfaMemoryStatevalue - value to get the type of; if value is a primitive wrapper, it will be unboxed before fetching the DfTypepublic DfType getDfType(DfaValue value)
getDfType in interface DfaMemoryStatevalue - value to get the type ofprotected void updateEquivalentVariables(DfaVariableValue dfaVar, com.intellij.codeInspection.dataFlow.DfaVariableState state)
protected com.intellij.codeInspection.dataFlow.DfaVariableState createVariableState(DfaVariableValue var)
public void flushFields()
flushFields in interface DfaMemoryStatepublic void flushVariable(DfaVariableValue variable)
flushVariable in interface DfaMemoryStateprotected void flushVariable(DfaVariableValue variable, boolean shouldMarkFlushed)
protected void afterMerge(DfaMemoryStateImpl other)
other - other memory start this one was merged with