Class AnalysisResult<V extends AbstractValue<V>,S extends Store<S>> 
java.lang.Object
org.checkerframework.dataflow.analysis.AnalysisResult<V,S> 
- Type Parameters:
- V- type of the abstract value that is tracked
- S- the store type used in the analysis
- All Implemented Interfaces:
- org.plumelib.util.UniqueId
public class AnalysisResult<V extends AbstractValue<V>,S extends Store<S>> 
extends Object
implements org.plumelib.util.UniqueId
An 
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.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final Map<TransferInput<V,S>, IdentityHashMap<Node, TransferResult<V, S>>> Caches of the analysis results.protected final Map<VariableElement,V> Map from (effectively final) local variable elements to their abstract value.protected final IdentityHashMap<Block,TransferInput<V, S>> The transfer inputs of every basic block; assumed to be 'no information' if not present.protected IdentityHashMap<Node,V> Abstract values of nodes.protected IdentityHashMap<UnaryTree,BinaryTree> Map from postfix increment or decrement trees that are ASTUnaryTrees to the synthetic tree that isv + 1orv - 1.protected IdentityHashMap<Tree,Set<Node>> 
- 
Constructor SummaryConstructorsModifierConstructorDescriptionAnalysisResult(IdentityHashMap<Node, V> nodeValues, IdentityHashMap<Block, TransferInput<V, S>> inputs, IdentityHashMap<Tree, Set<Node>> treeLookup, IdentityHashMap<UnaryTree, BinaryTree> postfixLookup, Map<VariableElement, V> finalLocalValues) Initialize with given mappings and empty cache.protectedAnalysisResult(IdentityHashMap<Node, V> nodeValues, IdentityHashMap<Block, TransferInput<V, S>> inputs, IdentityHashMap<Tree, Set<Node>> treeLookup, IdentityHashMap<UnaryTree, BinaryTree> postfixLookup, Map<VariableElement, V> finalLocalValues, Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Initialize with given mappings.AnalysisResult(Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Initialize empty result with specified cache.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcombine(AnalysisResult<V, S> other) Combine with another analysis result.Returns the value of effectively final local variables.getNodesForTree(Tree tree) Returns theNodes corresponding to a particularTree.getPostfixBinaryTree(UnaryTree postfixTree) Returns the syntheticv + 1orv - 1corresponding to the postfix increment or decrement tree.getStoreAfter(Tree tree) Returns the store immediately after a givenTree.getStoreAfter(Block block) Returns the regular store immediately after a given block.getStoreAfter(Node node) Returns the store immediately after a givenNode.getStoreBefore(Tree tree) Returns the store immediately before a givenTree.getStoreBefore(Block block) Returns the regular store immediately before a givenBlock.getStoreBefore(Node node) Returns the store immediately before a givenNode.longgetUid()lookupResult(Node node) Returns the cached TransferResult for a given node.static <V> StringnodeValuesToString(Map<Node, V> nodeValues) Returns a verbose string representation, useful for debugging.runAnalysisFor(Node node, Analysis.BeforeOrAfter preOrPost) Runs the analysis again within the block ofnodeand returns the store at the location ofnode.static <V extends AbstractValue<V>,S extends Store<S>> 
 SrunAnalysisFor(Node node, Analysis.BeforeOrAfter preOrPost, TransferInput<V, S> transferInput, IdentityHashMap<Node, V> nodeValues, @Nullable Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Runs the analysis again within the block ofnodeand returns the store at the location ofnode.Returns a verbose string representation of this, useful for debugging.static StringtreeLookupToString(Map<Tree, Set<Node>> treeLookup) Returns a verbose string representation of a map, useful for debugging.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.plumelib.util.UniqueIdgetClassAndUid
- 
Field Details- 
nodeValuesAbstract values of nodes.
- 
treeLookupMap from ASTTrees to sets ofNodes.Some of those Nodes might not be keys in nodeValues. One reason is that the Node is unreachable in the control flow graph, so dataflow never gave it a value.
- 
postfixLookupMap from postfix increment or decrement trees that are ASTUnaryTrees to the synthetic tree that isv + 1orv - 1.
- 
finalLocalValuesMap from (effectively final) local variable elements to their abstract value.
- 
inputsprotected final IdentityHashMap<Block,TransferInput<V extends AbstractValue<V>, inputsS extends Store<S>>> The transfer inputs of every basic block; assumed to be 'no information' if not present. The inputs are before blocks in forward analysis, and are after blocks in backward analysis.
- 
analysisCachesprotected final Map<TransferInput<V extends AbstractValue<V>,S extends Store<S>>, analysisCachesIdentityHashMap<Node, TransferResult<V extends AbstractValue<V>, S extends Store<S>>>> Caches of the analysis results. It maps from the TransferInput for a Block to a map. The inner map is from a node within the block to the TransferResult for that node.
 
- 
- 
Constructor Details- 
AnalysisResultprotected AnalysisResult(IdentityHashMap<Node, V> nodeValues, IdentityHashMap<Block, TransferInput<V, S>> inputs, IdentityHashMap<Tree, Set<Node>> treeLookup, IdentityHashMap<UnaryTree, BinaryTree> postfixLookup, Map<VariableElement, V> finalLocalValues, Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Initialize with given mappings.- Parameters:
- nodeValues-- nodeValues
- inputs-- inputs
- treeLookup-- treeLookup
- postfixLookup-- postfixLookup
- finalLocalValues-- finalLocalValues
- analysisCaches-- analysisCaches
 
- 
AnalysisResultpublic AnalysisResult(IdentityHashMap<Node, V> nodeValues, IdentityHashMap<Block, TransferInput<V, S>> inputs, IdentityHashMap<Tree, Set<Node>> treeLookup, IdentityHashMap<UnaryTree, BinaryTree> postfixLookup, Map<VariableElement, V> finalLocalValues) Initialize with given mappings and empty cache.- Parameters:
- nodeValues-- nodeValues
- inputs-- inputs
- treeLookup-- treeLookup
- postfixLookup-- postfixLookup
- finalLocalValues-- finalLocalValues
 
- 
AnalysisResultpublic AnalysisResult(Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Initialize empty result with specified cache.- Parameters:
- analysisCaches-- analysisCaches
 
 
- 
- 
Method Details- 
getUidpublic long getUid(@UnknownInitialization AnalysisResult<V extends AbstractValue<V>, S extends Store<S>> this) - Specified by:
- getUidin interface- org.plumelib.util.UniqueId
 
- 
combineCombine with another analysis result.- Parameters:
- other- an analysis result to combine with this
 
- 
getFinalLocalValuesReturns the value of effectively final local variables.- Returns:
- the value of effectively final local variables
 
- 
getValueReturns the abstract value forNoden, ornullif no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.- Parameters:
- n- a node
- Returns:
- the abstract value for Noden, ornullif no information is available
 
- 
getValueReturns the abstract value forTreet, ornullif no information is available. Note that if the analysis has not finished yet, this value might not represent the final value for this node.- Parameters:
- t- a tree
- Returns:
- the abstract value for Treet, ornullif no information is available
 
- 
getNodesForTreeReturns theNodes corresponding to a particularTree. MultipleNodes can correspond to a singleTreebecause of several reasons:- In a lambda expression such as () -> 5the5is both anIntegerLiteralNodeand aLambdaResultExpressionNode.
- Widening and narrowing primitive conversions can result in WideningConversionNodeandNarrowingConversionNode.
- Automatic String conversion can result in a StringConversionNode.
- Trees for finallyblocks are cloned to achieve a precise CFG. AnyTreewithin a finally block can have multiple correspondingNodes attached to them.
 Nodes they are not interested in.
- In a lambda expression such as 
- 
getPostfixBinaryTreeReturns the syntheticv + 1orv - 1corresponding to the postfix increment or decrement tree.- Parameters:
- postfixTree- a postfix increment or decrement tree
- Returns:
- the synthetic v + 1orv - 1corresponding to the postfix increment or decrement tree
 
- 
getStoreBeforeReturns the store immediately before a givenTree.- Parameters:
- tree- a tree
- Returns:
- the store immediately before a given Tree
 
- 
getStoreBeforeReturns the store immediately before a givenNode.- Parameters:
- node- a node
- Returns:
- the store immediately before a given Node
 
- 
getStoreBeforeReturns the regular store immediately before a givenBlock.- Parameters:
- block- a block
- Returns:
- the store right before the given block
 
- 
getStoreAfterReturns the regular store immediately after a given block.- Parameters:
- block- a block
- Returns:
- the store after the given block
 
- 
getStoreAfterReturns the store immediately after a givenTree.- Parameters:
- tree- a tree
- Returns:
- the store immediately after a given Tree
 
- 
getStoreAfterReturns the store immediately after a givenNode.- Parameters:
- node- a node
- Returns:
- the store immediately after a given Node
 
- 
runAnalysisForRuns the analysis again within the block ofnodeand returns the store at the location ofnode. Ifbeforeis true, then the store immediately before theNodenodeis returned. Otherwise, the store afternodeis returned.If the given Nodecannot be reached (in the control flow graph), thennullis returned.- Parameters:
- node- the node to analyze
- preOrPost- which store to return: the store immediately before- nodeor the store after- node
- Returns:
- the store before or after node(depends on the value ofbefore) after running the analysis
 
- 
runAnalysisForpublic static <V extends AbstractValue<V>,S extends Store<S>> S runAnalysisFor(Node node, Analysis.BeforeOrAfter preOrPost, TransferInput<V, S> transferInput, IdentityHashMap<Node, V> nodeValues, @Nullable Map<TransferInput<V, S>, IdentityHashMap<Node, TransferResult<V, S>>> analysisCaches) Runs the analysis again within the block ofnodeand returns the store at the location ofnode. Ifbeforeis true, then the store immediately before theNodenodeis returned. Otherwise, the store immediately afternodeis returned. IfanalysisCachesis not null, this method uses a cache.analysisCachesis a map of a block of node to the cached analysis result. If the cache fortransferInputis not inanalysisCaches, this method creates new cache and stores it inanalysisCaches. The cache is a map of nodes to the analysis results of the nodes.- Type Parameters:
- V- the abstract value type to be tracked by the analysis
- S- the store type used in the analysis
- Parameters:
- node- the node to analyze
- preOrPost- which store to return: the store immediately before- nodeor the store after- node
- transferInput- a transfer input
- nodeValues-- nodeValues
- analysisCaches-- analysisCaches
- Returns:
- the store before or after node(depends on the value ofbefore) after running the analysis
 
- 
lookupResultReturns the cached TransferResult for a given node.- Parameters:
- node- the node for which to look up a result
- Returns:
- the TransferResult at the given node
 
- 
toStringDebugReturns a verbose string representation of this, useful for debugging.- Returns:
- a string representation of this
 
- 
nodeValuesToStringReturns a verbose string representation, useful for debugging. The map has the same type as thenodeValuesfield.- Type Parameters:
- V- the type of values in the map
- Parameters:
- nodeValues- a map to format
- Returns:
- a printed representation of the given map
 
- 
treeLookupToStringReturns a verbose string representation of a map, useful for debugging. The map has the same type as thetreeLookupfield.- Parameters:
- treeLookup- a map to format
- Returns:
- a printed representation of the given map
 
 
-