Class DroppedException

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

public class DroppedException extends PreorderVisitor implements Detector
  • Field Details

    • DEBUG

      private static final boolean DEBUG
    • LOOK_IN_SOURCE_TO_FIND_COMMENTED_CATCH_BLOCKS

      private static final boolean LOOK_IN_SOURCE_TO_FIND_COMMENTED_CATCH_BLOCKS
    • causes

      Set<String> causes
    • checkedCauses

      Set<String> checkedCauses
    • bugReporter

      private final BugReporter bugReporter
    • bugAccumulator

      private final BugAccumulator bugAccumulator
    • classContext

      private ClassContext classContext
    • START

      private static final int START
      See Also:
    • CATCH

      private static final int CATCH
      See Also:
    • OPEN_PAREN

      private static final int OPEN_PAREN
      See Also:
    • CLOSE_PAREN

      private static final int CLOSE_PAREN
      See Also:
    • OPEN_BRACE

      private static final int OPEN_BRACE
      See Also:
    • NUM_CONTEXT_LINES

      private static final int NUM_CONTEXT_LINES
      Maximum number of lines we look backwards to find the "catch" keyword. Looking backwards is necessary when the indentation style puts the open brace on a different line from the catch clause.
      See Also:
    • MAX_LINES

      private static final int MAX_LINES
      The number of lines that we'll scan to look at the source for a catch block.
      See Also:
  • Constructor Details

    • DroppedException

      public DroppedException(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
    • 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
    • isChecked

      boolean isChecked(String c)
    • getUnsignedShort

      private int getUnsignedShort(byte[] a, int i)
    • visit

      public void visit(org.apache.bcel.classfile.Code obj)
      Overrides:
      visit in class BetterVisitor
    • getNextExecutableLineNumber

      private int getNextExecutableLineNumber(org.apache.bcel.classfile.LineNumberTable linenumbers, int PC)
    • catchBlockHasComment

      private boolean catchBlockHasComment(SourceLineAnnotation srcLine)
      Analyze a class's source code to see if there is a comment (or other text) in a catch block we have marked as dropping an exception.
      Returns:
      true if there is a comment in the catch block, false if not (or if we can't tell)