A
- type of the abstract value that is trackedpublic class AnalysisResult<A extends AbstractValue<A>,S extends Store<S>>
extends java.lang.Object
AnalysisResult
represents the result of a org.checkerframework.dataflow analysis by
providing the abstract values given a node or a tree. Note that it does not keep track of custom
results computed by some analysis.Modifier and Type | Field and Description |
---|---|
protected java.util.Map<TransferInput<A,S>,java.util.IdentityHashMap<Node,TransferResult<A,S>>> |
analysisCaches
Caches of the analysis results for each input for the block of the node and each node.
|
protected java.util.HashMap<javax.lang.model.element.Element,A> |
finalLocalValues
Map from (effectively final) local variable elements to their abstract value.
|
protected java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.List<com.sun.source.tree.Tree>> |
generatedTreesLookup
Map from AST
Tree s to generated Tree s. |
protected java.util.IdentityHashMap<Node,A> |
nodeValues
Abstract values of nodes.
|
protected java.util.IdentityHashMap<Block,TransferInput<A,S>> |
stores
The stores before every method call.
|
protected java.util.IdentityHashMap<com.sun.source.tree.Tree,Node> |
treeLookup
Map from AST
Tree s to Node s. |
protected java.util.IdentityHashMap<com.sun.source.tree.UnaryTree,AssignmentNode> |
unaryAssignNodeLookup
Map from AST
UnaryTree s to corresponding AssignmentNode s. |
Constructor and Description |
---|
AnalysisResult()
Initialize empty result.
|
AnalysisResult(java.util.Map<Node,A> nodeValues,
java.util.IdentityHashMap<Block,TransferInput<A,S>> stores,
java.util.IdentityHashMap<com.sun.source.tree.Tree,Node> treeLookup,
java.util.IdentityHashMap<com.sun.source.tree.UnaryTree,AssignmentNode> unaryAssignNodeLookup,
java.util.HashMap<javax.lang.model.element.Element,A> finalLocalValues,
java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.List<com.sun.source.tree.Tree>> generatedTreesLookup)
Initialize with a given node-value mapping.
|
AnalysisResult(java.util.Map<TransferInput<A,S>,java.util.IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
Initialize empty result with specified cache.
|
Modifier and Type | Method and Description |
---|---|
void |
combine(AnalysisResult<A,S> other)
Combine with another analysis result.
|
AssignmentNode |
getAssignForUnaryTree(com.sun.source.tree.UnaryTree tree) |
java.util.HashMap<javax.lang.model.element.Element,A> |
getFinalLocalValues() |
java.util.List<com.sun.source.tree.Tree> |
getGeneratedTrees(com.sun.source.tree.Tree tree) |
@Nullable Node |
getNodeForTree(com.sun.source.tree.Tree tree) |
S |
getStoreAfter(Node node) |
S |
getStoreAfter(com.sun.source.tree.Tree tree) |
S |
getStoreBefore(Node node) |
S |
getStoreBefore(com.sun.source.tree.Tree tree) |
A |
getValue(Node n) |
A |
getValue(com.sun.source.tree.Tree t) |
protected S |
runAnalysisFor(Node node,
boolean before)
Runs the analysis again within the block of
node and returns the store at the
location of node . |
static <A extends AbstractValue<A>,S extends Store<S>> |
runAnalysisFor(Node node,
boolean before,
TransferInput<A,S> transferInput)
Deprecated.
this method could be a cause of performance problem when you call this method
sometimes because this method runs analysis until
node from the first node in the
block of node without cache. You should use runAnalysisFor(Node, boolean,
TransferInput, Map) with a cache instead of this method. |
static <A extends AbstractValue<A>,S extends Store<S>> |
runAnalysisFor(Node node,
boolean before,
TransferInput<A,S> transferInput,
java.util.Map<TransferInput<A,S>,java.util.IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
Runs the analysis again within the block of
node and returns the store at the
location of node . |
protected final java.util.IdentityHashMap<Node,A extends AbstractValue<A>> nodeValues
protected final java.util.IdentityHashMap<com.sun.source.tree.Tree,Node> treeLookup
Tree
s to Node
s.protected final java.util.IdentityHashMap<com.sun.source.tree.UnaryTree,AssignmentNode> unaryAssignNodeLookup
UnaryTree
s to corresponding AssignmentNode
s.protected final java.util.HashMap<javax.lang.model.element.Element,A extends AbstractValue<A>> finalLocalValues
protected final java.util.IdentityHashMap<Block,TransferInput<A extends AbstractValue<A>,S extends Store<S>>> stores
protected final java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.List<com.sun.source.tree.Tree>> generatedTreesLookup
Tree
s to generated Tree
s.protected final java.util.Map<TransferInput<A extends AbstractValue<A>,S extends Store<S>>,java.util.IdentityHashMap<Node,TransferResult<A extends AbstractValue<A>,S extends Store<S>>>> analysisCaches
public AnalysisResult(java.util.Map<Node,A> nodeValues, java.util.IdentityHashMap<Block,TransferInput<A,S>> stores, java.util.IdentityHashMap<com.sun.source.tree.Tree,Node> treeLookup, java.util.IdentityHashMap<com.sun.source.tree.UnaryTree,AssignmentNode> unaryAssignNodeLookup, java.util.HashMap<javax.lang.model.element.Element,A> finalLocalValues, java.util.IdentityHashMap<com.sun.source.tree.Tree,java.util.List<com.sun.source.tree.Tree>> generatedTreesLookup)
public AnalysisResult()
public AnalysisResult(java.util.Map<TransferInput<A,S>,java.util.IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
public void combine(AnalysisResult<A,S> other)
public java.util.HashMap<javax.lang.model.element.Element,A> getFinalLocalValues()
public A getValue(Node n)
Node
n
, or null
if no information is
available.public A getValue(com.sun.source.tree.Tree t)
Tree
t
, or null
if no information is
available.public @Nullable Node getNodeForTree(com.sun.source.tree.Tree tree)
Node
for a given Tree
.public AssignmentNode getAssignForUnaryTree(com.sun.source.tree.UnaryTree tree)
AssignmentNode
for a given UnaryTree
.public java.util.List<com.sun.source.tree.Tree> getGeneratedTrees(com.sun.source.tree.Tree tree)
Tree
s for a given Tree
.public S getStoreBefore(com.sun.source.tree.Tree tree)
Tree
.public S getStoreBefore(Node node)
Node
.public S getStoreAfter(com.sun.source.tree.Tree tree)
Tree
.protected S runAnalysisFor(Node node, boolean before)
node
and returns the store at the
location of node
. If before
is true, then the store immediately before the
Node
node
is returned. Otherwise, the store after node
is returned.
If the given Node
cannot be reached (in the control flow graph), then null
is returned.
@Deprecated public static <A extends AbstractValue<A>,S extends Store<S>> S runAnalysisFor(Node node, boolean before, TransferInput<A,S> transferInput)
node
from the first node in the
block of node
without cache. You should use runAnalysisFor(Node, boolean,
TransferInput, Map)
with a cache instead of this method.node
and returns the store at the
location of node
. If before
is true, then the store immediately before the
Node
node
is returned. Otherwise, the store after node
is returned.public static <A extends AbstractValue<A>,S extends Store<S>> S runAnalysisFor(Node node, boolean before, TransferInput<A,S> transferInput, java.util.Map<TransferInput<A,S>,java.util.IdentityHashMap<Node,TransferResult<A,S>>> analysisCaches)
node
and returns the store at the
location of node
. If before
is true, then the store immediately before the
Node
node
is returned. Otherwise, the store after node
is returned.
If analysisCaches
is not null, this method uses a cache. analysisCaches
is a
map to a cache for analysis result from an input of the block of the node. If the cache for
transferInput
is not in analysisCaches
, this method create new cache and
store it in analysisCaches
. The cache is a map from a node to the analysis result of
the node.