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 DfaMemoryState
public DfaMemoryStateImpl createClosureState()
createClosureState
in interface DfaMemoryState
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public DfaValue pop()
DfaMemoryState
pop
in interface DfaMemoryState
public DfaValue peek()
DfaMemoryState
peek
in interface DfaMemoryState
public DfaValue getStackValue(int offset)
DfaMemoryState
getStackValue
in interface DfaMemoryState
offset
- value from the stack (0 = top of stack, 1 = the next one, etc.)public void push(DfaValue value)
DfaMemoryState
push
in interface DfaMemoryState
value
- to pushpublic void emptyStack()
emptyStack
in interface DfaMemoryState
public void setVarValue(DfaVariableValue var, DfaValue value)
setVarValue
in interface DfaMemoryState
protected DfType filterDfTypeOnAssignment(DfaVariableValue var, DfType dfType)
public boolean isSuperStateOf(DfaMemoryStateImpl that)
that
state.that
- a sub-state candidatepublic boolean shouldCompareByEquals(DfaValue dfaLeft, DfaValue dfaRight)
DfaMemoryState
shouldCompareByEquals
in interface DfaMemoryState
dfaLeft
- left valuedfaRight
- right valuepublic boolean isNull(DfaValue dfaValue)
isNull
in interface DfaMemoryState
public boolean isNotNull(DfaValue dfaVar)
isNotNull
in interface DfaMemoryState
public void markEphemeral()
DfaMemoryState
markEphemeral
in interface DfaMemoryState
public boolean isEphemeral()
isEphemeral
in interface DfaMemoryState
public boolean isEmptyStack()
isEmptyStack
in interface DfaMemoryState
public void setDfType(DfaValue value, DfType dfType)
DfaMemoryState
DfaMemoryState.meetDfType(DfaValue, DfType)
should be used as it narrows existing type.setDfType
in interface DfaMemoryState
value
- 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)
DfaMemoryState
meetDfType
in interface DfaMemoryState
value
- value to updatedfType
- wanted typepublic boolean applyContractCondition(DfaCondition condition)
applyContractCondition
in interface DfaMemoryState
public boolean areEqual(DfaValue value1, DfaValue value2)
DfaMemoryState
areEqual
in interface DfaMemoryState
value1
- first value to checkvalue2
- second value to checkpublic RelationType getRelation(DfaValue left, DfaValue right)
DfaMemoryState
getRelation
in interface DfaMemoryState
left
- first valueright
- second valuepublic boolean applyCondition(DfaCondition dfaCond)
applyCondition
in interface DfaMemoryState
public PsiType getPsiType(DfaValue value)
getPsiType
in interface DfaMemoryState
value
- value to get the type ofpublic boolean checkNotNullable(DfaValue value)
checkNotNullable
in interface DfaMemoryState
public LongRangeSet getBinOpRange(DfaBinOpValue binOp)
public DfType getUnboxedDfType(DfaValue value)
getUnboxedDfType
in interface DfaMemoryState
value
- 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 DfaMemoryState
value
- 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 DfaMemoryState
public void flushVariable(DfaVariableValue variable)
flushVariable
in interface DfaMemoryState
protected void flushVariable(DfaVariableValue variable, boolean shouldMarkFlushed)
protected void afterMerge(DfaMemoryStateImpl other)
other
- other memory start this one was merged with