|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.ByteCodePatternDetector
edu.umd.cs.findbugs.detect.BCPMethodReturnCheck
public class BCPMethodReturnCheck
This detector looks for places where the return value of a method is suspiciously ignored. Ignoring the return values from immutable objects such as java.lang.String are a common and easily found type of bug.
Field Summary | |
---|---|
private BugReporter |
bugReporter
|
private static boolean |
CHECK_ALL
|
private static AnalysisLocal<ByteCodePattern> |
localByteCodePattern
|
private static AnalysisLocal<java.util.ArrayList<PatternElement>> |
localPatternElementList
|
Fields inherited from interface edu.umd.cs.findbugs.Detector |
---|
EXP_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY |
Constructor Summary | |
---|---|
BCPMethodReturnCheck(BugReporter bugReporter)
Constructor. |
Method Summary | |
---|---|
static void |
addMethodWhoseReturnMustBeChecked(java.lang.String className,
java.lang.String methodName,
java.lang.String methodSig,
int mode)
|
static java.lang.String |
extractPackageName(java.lang.String className)
|
ByteCodePattern |
getPattern()
Get the ByteCodePattern for this detector. |
private static java.util.ArrayList<PatternElement> |
getPatternElementList()
Return List of PatternElement objects representing method invocations requiring a return value check. |
boolean |
prescreen(org.apache.bcel.classfile.Method method,
ClassContext classContext)
Prescreen a method. |
void |
reportMatch(ClassContext classContext,
org.apache.bcel.classfile.Method method,
ByteCodePatternMatch match)
Called to report an instance of the ByteCodePattern. |
Methods inherited from class edu.umd.cs.findbugs.ByteCodePatternDetector |
---|
getAnalysisContext, report, setAnalysisContext, visitClassContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final BugReporter bugReporter
private static final boolean CHECK_ALL
private static AnalysisLocal<ByteCodePattern> localByteCodePattern
private static AnalysisLocal<java.util.ArrayList<PatternElement>> localPatternElementList
Constructor Detail |
---|
public BCPMethodReturnCheck(BugReporter bugReporter)
bugReporter
- the BugReporter to report bug instances withMethod Detail |
---|
public ByteCodePattern getPattern()
ByteCodePatternDetector
getPattern
in class ByteCodePatternDetector
public static void addMethodWhoseReturnMustBeChecked(java.lang.String className, java.lang.String methodName, java.lang.String methodSig, int mode)
private static java.util.ArrayList<PatternElement> getPatternElementList()
public boolean prescreen(org.apache.bcel.classfile.Method method, ClassContext classContext)
ByteCodePatternDetector
As a datapoint, prescreening speeds up the BCPDoubleCheck detector by a factor of 5 with no loss of generality and only a dozen or so extra lines of code.
prescreen
in class ByteCodePatternDetector
method
- the methodclassContext
- the ClassContext for the method
public void reportMatch(ClassContext classContext, org.apache.bcel.classfile.Method method, ByteCodePatternMatch match)
ByteCodePatternDetector
reportMatch
in class ByteCodePatternDetector
classContext
- the ClassContext for the analyzed classmethod
- the method to instance appears inmatch
- the ByteCodePatternMatch object representing the match
of the ByteCodePattern against actual instructions in the methodpublic static java.lang.String extractPackageName(java.lang.String className)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |