Package edu.umd.cs.findbugs
Class SelfCalls
- java.lang.Object
-
- edu.umd.cs.findbugs.SelfCalls
-
public class SelfCalls extends java.lang.ObjectBuild a call graph of the self calls in a class.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashSet<org.apache.bcel.classfile.Method>calledMethodSetprivate CallGraphcallGraphprivate ClassContextclassContextprivate booleanhasSynchronizationprivate static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description SelfCalls(ClassContext classContext)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<org.apache.bcel.classfile.Method>calledMethodIterator()Get an Iterator over self-called methods.java.util.Iterator<CallSite>callSiteIterator()Get an Iterator over all self call sites.voidexecute()Find the self calls.CallGraphgetCallGraph()Get the self call graph for the class.booleanhasSynchronization()Does this class contain any explicit synchronization?private org.apache.bcel.classfile.MethodisSelfCall(org.apache.bcel.generic.InvokeInstruction inv)Is the given instruction a self-call?private voidscan(CallGraphNode node)Scan a method for self call sites.booleanwantCallsFor(org.apache.bcel.classfile.Method method)Determine whether we are interested in calls for the given method.
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
classContext
private final ClassContext classContext
-
callGraph
private final CallGraph callGraph
-
calledMethodSet
private final java.util.HashSet<org.apache.bcel.classfile.Method> calledMethodSet
-
hasSynchronization
private boolean hasSynchronization
-
-
Constructor Detail
-
SelfCalls
public SelfCalls(ClassContext classContext)
Constructor.- Parameters:
classContext- the ClassContext for the class
-
-
Method Detail
-
execute
public void execute() throws CFGBuilderExceptionFind the self calls.- Throws:
CFGBuilderException
-
getCallGraph
public CallGraph getCallGraph()
Get the self call graph for the class.
-
calledMethodIterator
public java.util.Iterator<org.apache.bcel.classfile.Method> calledMethodIterator()
Get an Iterator over self-called methods.
-
wantCallsFor
public boolean wantCallsFor(org.apache.bcel.classfile.Method method)
Determine whether we are interested in calls for the given method. Subclasses may override. The default version returns true for every method.- Parameters:
method- the method- Returns:
- true if we want call sites for the method, false if not
-
callSiteIterator
public java.util.Iterator<CallSite> callSiteIterator()
Get an Iterator over all self call sites.
-
hasSynchronization
public boolean hasSynchronization()
Does this class contain any explicit synchronization?
-
scan
private void scan(CallGraphNode node) throws CFGBuilderException
Scan a method for self call sites.- Parameters:
node- the CallGraphNode for the method to be scanned- Throws:
CFGBuilderException
-
isSelfCall
private org.apache.bcel.classfile.Method isSelfCall(org.apache.bcel.generic.InvokeInstruction inv)
Is the given instruction a self-call?
-
-