Class TypeReturnNull

All Implemented Interfaces:
Detector, Priorities, org.apache.bcel.classfile.Visitor
Direct Known Subclasses:
BooleanReturnNull, OptionalReturnNull

public abstract class TypeReturnNull extends OpcodeStackDetector
Base class for simple type checking detectors which tests if the method returns null references for specific types.
Author:
alison, Andrey Loskutov
  • Field Details

  • Constructor Details

    • TypeReturnNull

      public TypeReturnNull(BugReporter bugReporter)
  • Method Details

    • visit

      public void visit(org.apache.bcel.classfile.Code code)
      Overrides:
      visit in class DismantleBytecode
    • sawOpcode

      public void sawOpcode(int seen)
      Description copied from class: OpcodeStackDetector

      By default, this method will not be called when stack is TOP. To change this behavior, override #beforeOpcode(int) and change to return true even if stack is TOP.

      see Using FindBugs for Research to learn lattice and what TOP means.

      Specified by:
      sawOpcode in class OpcodeStackDetector
      See Also:
    • matchesReturnSignature

      protected abstract boolean matchesReturnSignature(String returnSignature)
      Returns:
      true if the given return signature matches expected type
    • accumulateBug

      protected abstract void accumulateBug()
      creates individual bug instance on match