public class TypeAnalysis extends FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame> implements EdgeTypes
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
Modifier and Type | Field and Description |
---|---|
protected CFG |
cfg |
static boolean |
DEBUG |
static boolean |
FORCE_ACCURATE_EXCEPTIONS
Force computation of accurate exceptions.
|
protected org.apache.bcel.generic.MethodGen |
methodGen |
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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).
|
boolean |
isImpliedByGenericTypes(org.apache.bcel.generic.ReferenceType t) |
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.
|
java.lang.String |
toString() |
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.
|
getFactAtPC, getFactBeforeExceptionCheck, getLastUpdateTimestamp, isTop, mergeInto, modifyFrame, setLastUpdateTimestamp
getBlockOrder, getDepthFirstSearch, isForwards
getFactAfterLocation, getFactAtLocation
edgeTransfer, factToString, finishIteration, getFactOnEdge, getResultFact, getStartFact, resultFactIterator, startIteration
public static final boolean DEBUG
public static final boolean FORCE_ACCURATE_EXCEPTIONS
protected org.apache.bcel.generic.MethodGen methodGen
protected CFG cfg
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 objectspublic void setValueNumberDataflow(ValueNumberDataflow valueNumberDataflow)
valueNumberDataflow
- the ValueNumberDataflowpublic void setFieldStoreTypeDatabase(FieldStoreTypeDatabase database)
database
- the FieldStoreTypeDatabasepublic ExceptionSet getEdgeExceptionSet(Edge edge)
edge
- the Edgepublic 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 instructionDataflowAnalysisException
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 blockDataflowAnalysisException
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 factDataflowAnalysisException
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 framesDataflowAnalysisException
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isImpliedByGenericTypes(org.apache.bcel.generic.ReferenceType t)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.