FindBugs™ 1.3.9

edu.umd.cs.findbugs.detect
Class BCPMethodReturnCheck

java.lang.Object
  extended by edu.umd.cs.findbugs.ByteCodePatternDetector
      extended by edu.umd.cs.findbugs.detect.BCPMethodReturnCheck
All Implemented Interfaces:
Detector, Priorities

Deprecated.

@Deprecated
public class BCPMethodReturnCheck
extends ByteCodePatternDetector

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.

Author:
David Hovemeyer, Bill Pugh

Field Summary
 
Fields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
 
Constructor Summary
BCPMethodReturnCheck(BugReporter bugReporter)
          Deprecated. Constructor.
 
Method Summary
static void addMethodWhoseReturnMustBeChecked(java.lang.String className, java.lang.String methodName, java.lang.String methodSig, int mode)
          Deprecated.  
static java.lang.String extractPackageName(java.lang.String className)
          Deprecated.  
protected  BugReporter getBugReporter()
          Deprecated.  
 ByteCodePattern getPattern()
          Deprecated. Get the ByteCodePattern for this detector.
 boolean prescreen(org.apache.bcel.classfile.Method method, ClassContext classContext)
          Deprecated. Prescreen a method.
 void reportMatch(ClassContext classContext, org.apache.bcel.classfile.Method method, ByteCodePatternMatch match)
          Deprecated. Called to report an instance of the ByteCodePattern.
 
Methods inherited from class edu.umd.cs.findbugs.ByteCodePatternDetector
report, visitClassContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BCPMethodReturnCheck

public BCPMethodReturnCheck(BugReporter bugReporter)
Deprecated. 
Constructor.

Parameters:
bugReporter - the BugReporter to report bug instances with
Method Detail

getPattern

public ByteCodePattern getPattern()
Deprecated. 
Description copied from class: ByteCodePatternDetector
Get the ByteCodePattern for this detector.

Specified by:
getPattern in class ByteCodePatternDetector

addMethodWhoseReturnMustBeChecked

public static void addMethodWhoseReturnMustBeChecked(java.lang.String className,
                                                     java.lang.String methodName,
                                                     java.lang.String methodSig,
                                                     int mode)
Deprecated. 

getBugReporter

protected BugReporter getBugReporter()
Deprecated. 
Specified by:
getBugReporter in class ByteCodePatternDetector

prescreen

public boolean prescreen(org.apache.bcel.classfile.Method method,
                         ClassContext classContext)
Deprecated. 
Description copied from class: ByteCodePatternDetector
Prescreen a method. It is a valid, but dumb, implementation simply to return true unconditionally. A better implementation is to call ClassContext.getBytecodeSet() to check whether the method actually contains the bytecode instructions that the pattern will look for. The theory is that checking the bytecode set is very fast, while building the MethodGen, CFG, ValueNumberAnalysis, etc. objects required to match ByteCodePatterns is slow, and the bytecode pattern matching algorithm is also not particularly fast.

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.

Specified by:
prescreen in class ByteCodePatternDetector
Parameters:
method - the method
classContext - the ClassContext for the method
Returns:
true if the method should be analyzed for instances of the ByteCodePattern

reportMatch

public void reportMatch(ClassContext classContext,
                        org.apache.bcel.classfile.Method method,
                        ByteCodePatternMatch match)
Deprecated. 
Description copied from class: ByteCodePatternDetector
Called to report an instance of the ByteCodePattern.

Specified by:
reportMatch in class ByteCodePatternDetector
Parameters:
classContext - the ClassContext for the analyzed class
method - the method to instance appears in
match - the ByteCodePatternMatch object representing the match of the ByteCodePattern against actual instructions in the method

extractPackageName

public static java.lang.String extractPackageName(java.lang.String className)
Deprecated. 

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.