Class ReturnPathTypeAnalysis
java.lang.Object
edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<ReturnPathType>
edu.umd.cs.findbugs.ba.npe.ReturnPathTypeAnalysis
- All Implemented Interfaces:
DataflowAnalysis<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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CFGprivate final DepthFirstSearchprivate final ReverseDepthFirstSearch -
Constructor Summary
ConstructorsConstructorDescriptionReturnPathTypeAnalysis(CFG cfg, ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcopy(ReturnPathType source, ReturnPathType dest) Copy dataflow facts.Create empty (uninitialized) dataflow facts for one program point.voidedgeTransfer(Edge edge, ReturnPathType fact) Edge transfer function.voidCalled after finishing an iteration of analysis.getBlockOrder(CFG cfg) Return the BlockOrder specifying the order in which BasicBlocks should be visited in the main dataflow loop.intvoidinitEntryFact(ReturnPathType result) Initialize the "entry" fact for the graph.booleanReturns true if the analysis is forwards, false if backwards.booleanisTop(ReturnPathType fact) Is the given fact the top value.voidmakeFactTop(ReturnPathType fact) Make given fact the top value.voidmeetInto(ReturnPathType fact, Edge edge, ReturnPathType result) Meet a dataflow fact associated with an incoming edge into another fact.booleansame(ReturnPathType fact1, ReturnPathType fact2) Are given dataflow facts the same?voidsetLastUpdateTimestamp(ReturnPathType fact, int timestamp) voidCalled before beginning an iteration of analysis.voidtransfer(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, ReturnPathType start, ReturnPathType result) Transfer function for the analysis.Methods inherited from class BasicAbstractDataflowAnalysis
factToString, getFactAfterLocation, getFactAtLocation, getFactOnEdge, getResultFact, getStartFact, resultFactIterator
-
Field Details
-
cfg
-
dfs
-
rdfs
-
-
Constructor Details
-
ReturnPathTypeAnalysis
Constructor.- Parameters:
cfg- the method's CFGrdfs- a ReverseDepthFirstSearch on the method's CFGdfs- a DepthFirstSearch on the method's CFG
-
-
Method Details
-
copy
Description copied from interface:DataflowAnalysisCopy dataflow facts. -
createFact
Description copied from interface:DataflowAnalysisCreate empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used. -
edgeTransfer
Description copied from interface:DataflowAnalysisEdge 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:
edgeTransferin interfaceDataflowAnalysis<ReturnPathType>- Overrides:
edgeTransferin classBasicAbstractDataflowAnalysis<ReturnPathType>- Parameters:
edge- the Edgefact- a dataflow fact
-
finishIteration
public void finishIteration()Description copied from interface:DataflowAnalysisCalled after finishing an iteration of analysis.- Specified by:
finishIterationin interfaceDataflowAnalysis<ReturnPathType>- Overrides:
finishIterationin classBasicAbstractDataflowAnalysis<ReturnPathType>
-
getBlockOrder
Description copied from interface:DataflowAnalysisReturn 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
- Specified by:
getLastUpdateTimestampin interfaceDataflowAnalysis<ReturnPathType>- Overrides:
getLastUpdateTimestampin classBasicAbstractDataflowAnalysis<ReturnPathType>
-
initEntryFact
Description copied from interface:DataflowAnalysisInitialize the "entry" fact for the graph.- Throws:
DataflowAnalysisException
-
isForwards
public boolean isForwards()Description copied from interface:DataflowAnalysisReturns true if the analysis is forwards, false if backwards. -
isTop
Description copied from interface:DataflowAnalysisIs the given fact the top value. -
makeFactTop
Description copied from interface:DataflowAnalysisMake given fact the top value. -
meetInto
public void meetInto(ReturnPathType fact, Edge edge, ReturnPathType result) throws DataflowAnalysisException Description copied from interface:DataflowAnalysisMeet 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 predecessorresult- the result fact- Throws:
DataflowAnalysisException
-
same
Description copied from interface:DataflowAnalysisAre given dataflow facts the same? -
setLastUpdateTimestamp
- Specified by:
setLastUpdateTimestampin interfaceDataflowAnalysis<ReturnPathType>- Overrides:
setLastUpdateTimestampin classBasicAbstractDataflowAnalysis<ReturnPathType>
-
startIteration
public void startIteration()Description copied from interface:DataflowAnalysisCalled before beginning an iteration of analysis. Each iteration visits every basic block in the CFG.- Specified by:
startIterationin interfaceDataflowAnalysis<ReturnPathType>- Overrides:
startIterationin classBasicAbstractDataflowAnalysis<ReturnPathType>
-
transfer
public void transfer(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, ReturnPathType start, ReturnPathType result) throws DataflowAnalysisException Description copied from interface:DataflowAnalysisTransfer 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 blockend- if nonnull, stop before considering this instruction; otherwise, consider all of the instructions in the basic blockstart- 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
-