FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba.npe
Class ReturnPathTypeAnalysis

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<ReturnPathType>
      extended by edu.umd.cs.findbugs.ba.npe.ReturnPathTypeAnalysis
All Implemented Interfaces:
DataflowAnalysis<ReturnPathType>

public class ReturnPathTypeAnalysis
extends BasicAbstractDataflowAnalysis<ReturnPathType>

A dataflow analysis to determine, at each location in a method's CFG, whether or not it is possible to return normally at that location.

Author:
David Hovemeyer

Constructor Summary
ReturnPathTypeAnalysis(CFG cfg, ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs)
          Constructor.
 
Method Summary
 void copy(ReturnPathType source, ReturnPathType dest)
          Copy dataflow facts.
 ReturnPathType createFact()
          Create empty (uninitialized) dataflow facts for one program point.
 void edgeTransfer(Edge edge, ReturnPathType fact)
          Edge transfer function.
 void finishIteration()
          Called after finishing an iteration of analysis.
 BlockOrder getBlockOrder(CFG cfg)
          Return the BlockOrder specifying the order in which BasicBlocks should be visited in the main dataflow loop.
 int getLastUpdateTimestamp(ReturnPathType fact)
           
 void initEntryFact(ReturnPathType result)
          Initialize the "entry" fact for the graph.
 boolean isForwards()
          Returns true if the analysis is forwards, false if backwards.
 boolean isTop(ReturnPathType fact)
          Is the given fact the top value.
 void makeFactTop(ReturnPathType fact)
          Make given fact the top value.
 void meetInto(ReturnPathType fact, Edge edge, ReturnPathType result)
          Meet a dataflow fact associated with an incoming edge into another fact.
 boolean same(ReturnPathType fact1, ReturnPathType fact2)
          Are given dataflow facts the same?
 void setLastUpdateTimestamp(ReturnPathType fact, int timestamp)
           
 void startIteration()
          Called before beginning an iteration of analysis.
 void transfer(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, ReturnPathType start, ReturnPathType result)
          Transfer function for the analysis.
 
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
factToString, getFactAfterLocation, getFactAtLocation, getFactOnEdge, getResultFact, getStartFact, resultFactIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReturnPathTypeAnalysis

public ReturnPathTypeAnalysis(CFG cfg,
                              ReverseDepthFirstSearch rdfs,
                              DepthFirstSearch dfs)
Constructor.

Parameters:
cfg - the method's CFG
rdfs - a ReverseDepthFirstSearch on the method's CFG
dfs - a DepthFirstSearch on the method's CFG
Method Detail

copy

public void copy(ReturnPathType source,
                 ReturnPathType dest)
Description copied from interface: DataflowAnalysis
Copy dataflow facts.


createFact

public ReturnPathType createFact()
Description copied from interface: DataflowAnalysis
Create empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used.


edgeTransfer

public void edgeTransfer(Edge edge,
                         ReturnPathType fact)
Description copied from interface: DataflowAnalysis
Edge transfer function. Modify the given fact that is true on the (logical) edge source to modify it so that it is true at the (logical) edge target.

A do-nothing implementation is legal, and appropriate for analyses where branches are not significant.

Specified by:
edgeTransfer in interface DataflowAnalysis<ReturnPathType>
Overrides:
edgeTransfer in class BasicAbstractDataflowAnalysis<ReturnPathType>
Parameters:
edge - the Edge
fact - a dataflow fact

finishIteration

public void finishIteration()
Description copied from interface: DataflowAnalysis
Called after finishing an iteration of analysis.

Specified by:
finishIteration in interface DataflowAnalysis<ReturnPathType>
Overrides:
finishIteration in class BasicAbstractDataflowAnalysis<ReturnPathType>

getBlockOrder

public BlockOrder getBlockOrder(CFG cfg)
Description copied from interface: DataflowAnalysis
Return the BlockOrder specifying the order in which BasicBlocks should be visited in the main dataflow loop.

Parameters:
cfg - the CFG upon which we're performing dataflow analysis

getLastUpdateTimestamp

public int getLastUpdateTimestamp(ReturnPathType fact)
Specified by:
getLastUpdateTimestamp in interface DataflowAnalysis<ReturnPathType>
Overrides:
getLastUpdateTimestamp in class BasicAbstractDataflowAnalysis<ReturnPathType>

initEntryFact

public void initEntryFact(ReturnPathType result)
                   throws DataflowAnalysisException
Description copied from interface: DataflowAnalysis
Initialize the "entry" fact for the graph.

Throws:
DataflowAnalysisException

isForwards

public boolean isForwards()
Description copied from interface: DataflowAnalysis
Returns true if the analysis is forwards, false if backwards.


isTop

public boolean isTop(ReturnPathType fact)
Description copied from interface: DataflowAnalysis
Is the given fact the top value.


makeFactTop

public void makeFactTop(ReturnPathType fact)
Description copied from interface: DataflowAnalysis
Make given fact the top value.


meetInto

public void meetInto(ReturnPathType fact,
                     Edge edge,
                     ReturnPathType result)
              throws DataflowAnalysisException
Description copied from interface: DataflowAnalysis
Meet a dataflow fact associated with an incoming edge into another fact. This is used to determine the start fact for a basic block.

Parameters:
fact - the predecessor fact (incoming edge)
edge - the edge from the predecessor
result - the result fact
Throws:
DataflowAnalysisException

same

public boolean same(ReturnPathType fact1,
                    ReturnPathType fact2)
Description copied from interface: DataflowAnalysis
Are given dataflow facts the same?


setLastUpdateTimestamp

public void setLastUpdateTimestamp(ReturnPathType fact,
                                   int timestamp)
Specified by:
setLastUpdateTimestamp in interface DataflowAnalysis<ReturnPathType>
Overrides:
setLastUpdateTimestamp in class BasicAbstractDataflowAnalysis<ReturnPathType>

startIteration

public void startIteration()
Description copied from interface: DataflowAnalysis
Called before beginning an iteration of analysis. Each iteration visits every basic block in the CFG.

Specified by:
startIteration in interface DataflowAnalysis<ReturnPathType>
Overrides:
startIteration in class BasicAbstractDataflowAnalysis<ReturnPathType>

transfer

public void transfer(BasicBlock basicBlock,
                     org.apache.bcel.generic.InstructionHandle end,
                     ReturnPathType start,
                     ReturnPathType result)
              throws DataflowAnalysisException
Description copied from interface: DataflowAnalysis
Transfer function for the analysis. Taking dataflow facts at start (which might be either the entry or exit of the block, depending on whether the analysis is forwards or backwards), modify result to be the facts at the other end of the block.

Parameters:
basicBlock - the basic block
end - if nonnull, stop before considering this instruction; otherwise, consider all of the instructions in the basic block
start - dataflow facts at beginning of block (if forward analysis) or end of block (if backwards analysis)
result - resulting dataflow facts at other end of block
Throws:
DataflowAnalysisException

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.