Class FindRefComparison

java.lang.Object
edu.umd.cs.findbugs.detect.FindRefComparison
All Implemented Interfaces:
ExtendedTypes, Detector, Priorities

public class FindRefComparison extends Object implements Detector, ExtendedTypes
Find suspicious reference comparisons. This includes:
  • Strings and other java.lang objects compared by reference equality
  • Calls to equals(Object) where the argument is a different type than the receiver object
Author:
David Hovemeyer, Bill Pugh
  • Constructor Details

    • FindRefComparison

      public FindRefComparison(BugReporter bugReporter)
  • Method Details

    • visitClassContext

      public void visitClassContext(ClassContext classContext)
      Description copied from interface: Detector
      Visit the ClassContext for a class which should be analyzed for instances of bug patterns.
      Specified by:
      visitClassContext in interface Detector
      Parameters:
      classContext - the ClassContext
    • getMethodCalledAnnotation

      @CheckForNull public MethodAnnotation getMethodCalledAnnotation(org.apache.bcel.generic.ConstantPoolGen cpg, org.apache.bcel.generic.InvokeInstruction inv)
    • getInvokedMethod

      public MethodDescriptor getInvokedMethod(org.apache.bcel.generic.ConstantPoolGen cpg, org.apache.bcel.generic.InvokeInstruction inv)
    • report

      public void report()
      Description copied from interface: Detector
      This method is called after all classes to be visited. It should be used by any detectors which accumulate information over all visited classes to generate results.
      Specified by:
      report in interface Detector