public class Invoke extends PatternElement
Invoke objects match by class name, method name, method signature, and mode.
Names and signatures may be matched in several ways:
The mode specifies what kind of invocations in the Invoke element matches. It is specified as the bitwise combination of the following values:
INSTANCE
, which matches ordinary instance method invocations
STATIC
, which matches static method invocations
CONSTRUCTOR
, which matches object constructor invocations
ORDINARY_METHOD
is equivalent to
INSTANCE|STATIC
. The special mode ANY
is equivalent
to INSTANCE|STATIC|CONSTRUCTOR
.PatternElement
Modifier and Type | Field and Description |
---|---|
static int |
ANY
Match both static and instance invocations.
|
static int |
CONSTRUCTOR
Match object constructor invocations.
|
static int |
INSTANCE
Match ordinary (non-constructor) instance invocations.
|
static int |
ORDINARY_METHOD
Match ordinary methods (everything except constructors).
|
static int |
STATIC
Match static invocations.
|
Constructor and Description |
---|
Invoke(java.lang.String className,
java.lang.String methodName,
java.lang.String methodSig,
int mode,
RepositoryLookupFailureCallback lookupFailureCallback)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptBranch(Edge edge,
org.apache.bcel.generic.InstructionHandle source)
Return whether or not it is acceptable to take the given branch.
|
MatchResult |
match(org.apache.bcel.generic.InstructionHandle handle,
org.apache.bcel.generic.ConstantPoolGen cpg,
ValueNumberFrame before,
ValueNumberFrame after,
BindingSet bindingSet)
Return whether or not this element matches the given instruction with the
given Bindings in effect.
|
int |
maxOccur()
Return the maximum number of instructions this PatternElement must match
in the ByteCodePattern.
|
int |
minOccur()
Return the minimum number of instructions this PatternElement must match
in the ByteCodePattern.
|
addOrCheckDefinition, allowTrailingEdges, dominatedBy, getDominatedBy, getLabel, getNext, label, lookup, setAllowTrailingEdges, setIndex, setNext, toString
public static final int INSTANCE
public static final int STATIC
public static final int CONSTRUCTOR
public static final int ORDINARY_METHOD
public static final int ANY
public Invoke(java.lang.String className, java.lang.String methodName, java.lang.String methodSig, int mode, @Nullable RepositoryLookupFailureCallback lookupFailureCallback)
className
- the class name of the method; may be specified exactly, as a
regexp, or as a subtype matchmethodName
- the name of the method; may be specified exactly or as a
regexpmethodSig
- the signature of the method; may be specified exactly or as a
regexpmode
- the mode of invocationpublic MatchResult match(org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) throws DataflowAnalysisException
PatternElement
match
in class PatternElement
handle
- the instructioncpg
- the ConstantPoolGen from the methodbefore
- the ValueNumberFrame representing values in the Java stack
frame just before the execution of the instructionafter
- the ValueNumberFrame representing values in the Java stack
frame just after the execution of the instructionbindingSet
- the set of BindingsDataflowAnalysisException
public boolean acceptBranch(Edge edge, org.apache.bcel.generic.InstructionHandle source)
PatternElement
acceptBranch
in class PatternElement
edge
- the Edge representing the branchsource
- the source instruction of the branchpublic int minOccur()
PatternElement
minOccur
in class PatternElement
public int maxOccur()
PatternElement
maxOccur
in class PatternElement
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.