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, setLastUpdateTimestampgetBlockOrder, getDepthFirstSearch, isForwardsgetFactAfterLocation, getFactAtLocationedgeTransfer, factToString, finishIteration, getFactOnEdge, getResultFact, getStartFact, resultFactIterator, startIterationpublic 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()
DataflowAnalysiscreateFact in interface DataflowAnalysis<TypeFrame>public void initEntryFact(TypeFrame result)
DataflowAnalysisinitEntryFact in interface DataflowAnalysis<TypeFrame>public void copy(TypeFrame source, TypeFrame dest)
DataflowAnalysiscopy in interface DataflowAnalysis<TypeFrame>copy in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>public void makeFactTop(TypeFrame fact)
DataflowAnalysismakeFactTop in interface DataflowAnalysis<TypeFrame>makeFactTop in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>public boolean isFactValid(TypeFrame fact)
AbstractDataflowAnalysisisFactValid in class FrameDataflowAnalysis<org.apache.bcel.generic.Type,TypeFrame>public boolean same(TypeFrame fact1, TypeFrame fact2)
DataflowAnalysissame 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
AbstractDataflowAnalysistransferInstruction 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 instructionDataflowAnalysisExceptionpublic void transfer(BasicBlock basicBlock, @CheckForNull org.apache.bcel.generic.InstructionHandle end, TypeFrame start, TypeFrame result) throws DataflowAnalysisException
DataflowAnalysistransfer 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 blockDataflowAnalysisExceptionpublic void meetInto(TypeFrame fact, Edge edge, TypeFrame result) throws DataflowAnalysisException
DataflowAnalysismeetInto in interface DataflowAnalysis<TypeFrame>fact - the predecessor fact (incoming edge)edge - the edge from the predecessorresult - the result factDataflowAnalysisExceptionprotected void mergeValues(TypeFrame otherFrame, TypeFrame resultFrame, int slot) throws DataflowAnalysisException
FrameDataflowAnalysismergeValues 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 framesDataflowAnalysisExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isImpliedByGenericTypes(org.apache.bcel.generic.ReferenceType t)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.