Class FindComparatorProblems

All Implemented Interfaces:
Detector, Priorities, org.apache.bcel.classfile.Visitor

public class FindComparatorProblems extends OpcodeStackDetector
  • Field Details

    • FLOAT_DESCRIPTOR

      private static final MethodDescriptor FLOAT_DESCRIPTOR
    • DOUBLE_DESCRIPTOR

      private static final MethodDescriptor DOUBLE_DESCRIPTOR
    • isComparator

      private boolean isComparator
    • lastEmptyStackPC

      private int lastEmptyStackPC
    • twoDoublesInStack

      private List<int[]> twoDoublesInStack
    • accumulator

      private final BugAccumulator accumulator
  • Constructor Details

    • FindComparatorProblems

      public FindComparatorProblems(BugReporter reporter)
  • 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
      Overrides:
      visitClassContext in class BytecodeScanningDetector
      Parameters:
      classContext - the ClassContext
    • shouldVisitCode

      public boolean shouldVisitCode(org.apache.bcel.classfile.Code obj)
      Description copied from class: BytecodeScanningDetector
      Check see if the Code for this method should be visited.
      Overrides:
      shouldVisitCode in class BytecodeScanningDetector
      Parameters:
      obj - Code attribute
      Returns:
      true if the Code should be visited
    • visit

      public void visit(org.apache.bcel.classfile.Code obj)
      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:
    • codeEquals

      private boolean codeEquals(int[] oldStartEnd, int[] startEnd)
      Parameters:
      oldStartEnd - - int[] {oldStart, oldEnd}
      startEnd - - int[] {start, end}
      Returns:
      true if code slices are the same