|
FindBugs™ 1.3.9 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<Fact>
edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<Fact>
edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis<FrameType>
edu.umd.cs.findbugs.ba.FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>
edu.umd.cs.findbugs.ba.type.TypeAnalysis
public class TypeAnalysis
A forward dataflow analysis to determine the types of all values in the Java stack frame at all points in a Java method. The values include local variables and values on the Java operand stack.
As a side effect, the analysis computes the exception set throwable on each exception edge in the CFG. This information can be used to prune infeasible exception edges, and mark exception edges which propagate only implicit exceptions.
Dataflow
,
DataflowAnalysis
,
TypeFrame
Field Summary | |
---|---|
protected CFG |
cfg
|
static boolean |
DEBUG
|
static boolean |
FORCE_ACCURATE_EXCEPTIONS
Force computation of accurate exceptions. |
protected org.apache.bcel.generic.MethodGen |
methodGen
|
Fields inherited from interface edu.umd.cs.findbugs.ba.EdgeTypes |
---|
BACKEDGE_SOURCE_EDGE, BACKEDGE_TARGET_EDGE, CHECKED_EXCEPTIONS_FLAG, EXIT_EDGE, EXPLICIT_EXCEPTIONS_FLAG, FALL_THROUGH_EDGE, GOTO_EDGE, HANDLED_EXCEPTION_EDGE, IFCMP_EDGE, JSR_EDGE, RET_EDGE, RETURN_EDGE, START_EDGE, SWITCH_DEFAULT_EDGE, SWITCH_EDGE, UNHANDLED_EXCEPTION_EDGE, UNKNOWN_EDGE |
Constructor Summary | |
---|---|
TypeAnalysis(org.apache.bcel.classfile.Method method,
org.apache.bcel.generic.MethodGen methodGen,
CFG cfg,
DepthFirstSearch dfs,
RepositoryLookupFailureCallback lookupFailureCallback,
ExceptionSetFactory exceptionSetFactory)
Constructor which uses StandardTypeMerger. |
|
TypeAnalysis(org.apache.bcel.classfile.Method method,
org.apache.bcel.generic.MethodGen methodGen,
CFG cfg,
DepthFirstSearch dfs,
TypeMerger typeMerger,
RepositoryLookupFailureCallback lookupFailureCallback,
ExceptionSetFactory exceptionSetFactory)
Constructor. |
|
TypeAnalysis(org.apache.bcel.classfile.Method method,
org.apache.bcel.generic.MethodGen methodGen,
CFG cfg,
DepthFirstSearch dfs,
TypeMerger typeMerger,
TypeFrameModelingVisitor visitor,
RepositoryLookupFailureCallback lookupFailureCallback,
ExceptionSetFactory exceptionSetFactory)
Constructor. |
Method Summary | |
---|---|
void |
copy(TypeFrame source,
TypeFrame dest)
Copy dataflow facts. |
TypeFrame |
createFact()
Create empty (uninitialized) dataflow facts for one program point. |
ExceptionSet |
getEdgeExceptionSet(Edge edge)
Get the set of exceptions that can be thrown on given edge. |
void |
initEntryFact(TypeFrame result)
Initialize the "entry" fact for the graph. |
boolean |
isFactValid(TypeFrame fact)
Determine whether the given fact is valid (neither top nor bottom). |
void |
makeFactTop(TypeFrame fact)
Make given fact the top value. |
void |
meetInto(TypeFrame fact,
Edge edge,
TypeFrame result)
Meet a dataflow fact associated with an incoming edge into another fact. |
protected void |
mergeValues(TypeFrame otherFrame,
TypeFrame resultFrame,
int slot)
Merge the values contained in a given slot of two Frames. |
boolean |
same(TypeFrame fact1,
TypeFrame fact2)
Are given dataflow facts the same? |
void |
setFieldStoreTypeDatabase(FieldStoreTypeDatabase database)
Set the FieldStoreTypeDatabase. |
void |
setValueNumberDataflow(ValueNumberDataflow valueNumberDataflow)
Set the ValueNumberDataflow for the method being analyzed. |
void |
transfer(BasicBlock basicBlock,
org.apache.bcel.generic.InstructionHandle end,
TypeFrame start,
TypeFrame result)
Transfer function for the analysis. |
void |
transferInstruction(org.apache.bcel.generic.InstructionHandle handle,
BasicBlock basicBlock,
TypeFrame fact)
Transfer function for a single instruction. |
Methods inherited from class edu.umd.cs.findbugs.ba.FrameDataflowAnalysis |
---|
getLastUpdateTimestamp, isTop, mergeInto, modifyFrame, setLastUpdateTimestamp |
Methods inherited from class edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis |
---|
getBlockOrder, getDepthFirstSearch, isForwards |
Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis |
---|
getFactAfterLocation, getFactAtLocation |
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis |
---|
edgeTransfer, factToString, finishIteration, getFactOnEdge, getResultFact, getStartFact, resultFactIterator, startIteration |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean DEBUG
public static final boolean FORCE_ACCURATE_EXCEPTIONS
protected org.apache.bcel.generic.MethodGen methodGen
protected CFG cfg
Constructor Detail |
---|
public TypeAnalysis(org.apache.bcel.classfile.Method method, org.apache.bcel.generic.MethodGen methodGen, CFG cfg, DepthFirstSearch dfs, TypeMerger typeMerger, TypeFrameModelingVisitor visitor, RepositoryLookupFailureCallback lookupFailureCallback, ExceptionSetFactory exceptionSetFactory)
method
- TODOmethodGen
- the MethodGen whose CFG we'll be analyzingcfg
- the control flow graphdfs
- DepthFirstSearch of the methodtypeMerger
- object to merge typesvisitor
- a TypeFrameModelingVisitor to use to model the effect
of instructionslookupFailureCallback
- lookup failure callbackexceptionSetFactory
- factory for creating ExceptionSet objectspublic TypeAnalysis(org.apache.bcel.classfile.Method method, org.apache.bcel.generic.MethodGen methodGen, CFG cfg, DepthFirstSearch dfs, TypeMerger typeMerger, RepositoryLookupFailureCallback lookupFailureCallback, ExceptionSetFactory exceptionSetFactory)
method
- TODOmethodGen
- the MethodGen whose CFG we'll be analyzingcfg
- the control flow graphdfs
- DepthFirstSearch of the methodtypeMerger
- object to merge typeslookupFailureCallback
- lookup failure callbackexceptionSetFactory
- factory for creating ExceptionSet objectspublic TypeAnalysis(org.apache.bcel.classfile.Method method, org.apache.bcel.generic.MethodGen methodGen, CFG cfg, DepthFirstSearch dfs, RepositoryLookupFailureCallback lookupFailureCallback, ExceptionSetFactory exceptionSetFactory)
method
- TODOmethodGen
- the MethodGen whose CFG we'll be analyzingcfg
- the control flow graphdfs
- DepthFirstSearch of the methodlookupFailureCallback
- callback for Repository lookup failuresexceptionSetFactory
- factory for creating ExceptionSet objectsMethod Detail |
---|
public void setValueNumberDataflow(ValueNumberDataflow valueNumberDataflow)
valueNumberDataflow
- the ValueNumberDataflowpublic void setFieldStoreTypeDatabase(FieldStoreTypeDatabase database)
database
- the FieldStoreTypeDatabasepublic ExceptionSet getEdgeExceptionSet(Edge edge)
edge
- the Edge
public TypeFrame createFact()
DataflowAnalysis
createFact
in interface DataflowAnalysis<TypeFrame>
public void initEntryFact(TypeFrame result)
DataflowAnalysis
initEntryFact
in interface DataflowAnalysis<TypeFrame>
public void copy(TypeFrame source, TypeFrame dest)
DataflowAnalysis
copy
in interface DataflowAnalysis<TypeFrame>
copy
in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>
public void makeFactTop(TypeFrame fact)
DataflowAnalysis
makeFactTop
in interface DataflowAnalysis<TypeFrame>
makeFactTop
in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>
public boolean isFactValid(TypeFrame fact)
AbstractDataflowAnalysis
isFactValid
in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>
public boolean same(TypeFrame fact1, TypeFrame fact2)
DataflowAnalysis
same
in interface DataflowAnalysis<TypeFrame>
same
in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>
public void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, TypeFrame fact) throws DataflowAnalysisException
AbstractDataflowAnalysis
transferInstruction
in class AbstractDataflowAnalysis<TypeFrame>
handle
- the instructionbasicBlock
- the BasicBlock containing the instruction; needed to disambiguate
instructions in inlined JSR subroutinesfact
- which should be modified based on the instruction
DataflowAnalysisException
public void transfer(BasicBlock basicBlock, @CheckForNull org.apache.bcel.generic.InstructionHandle end, TypeFrame start, TypeFrame result) throws DataflowAnalysisException
DataflowAnalysis
transfer
in interface DataflowAnalysis<TypeFrame>
transfer
in class AbstractDataflowAnalysis<TypeFrame>
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
DataflowAnalysisException
public void meetInto(TypeFrame fact, Edge edge, TypeFrame result) throws DataflowAnalysisException
DataflowAnalysis
meetInto
in interface DataflowAnalysis<TypeFrame>
fact
- the predecessor fact (incoming edge)edge
- the edge from the predecessorresult
- the result fact
DataflowAnalysisException
protected void mergeValues(TypeFrame otherFrame, TypeFrame resultFrame, int slot) throws DataflowAnalysisException
FrameDataflowAnalysis
mergeValues
in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>
otherFrame
- a FrameresultFrame
- a Frame which will contain the resulting merged valueslot
- a slot in both frames
DataflowAnalysisException
|
FindBugs™ 1.3.9 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |