Class FindArgumentAssertions

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

public class FindArgumentAssertions extends AbstractAssertDetector
This detector can find Assertions that try to validate method arguments.
  • Constructor Details

    • FindArgumentAssertions

      public FindArgumentAssertions(BugReporter bugReporter)
  • Method Details

    • visitClassContext

      public void visitClassContext(ClassContext classContext)
      Only interested in public classes
      Specified by:
      visitClassContext in interface Detector
      Overrides:
      visitClassContext in class BytecodeScanningDetector
      Parameters:
      classContext - the ClassContext
    • isInitialArg

      private boolean isInitialArg()
      Checks if the methods parameter is an initial arg.
    • isMethodCall

      private boolean isMethodCall(int seen)
      Returns true if the opcode is a method invocation false otherwise
    • checkSeen

      private int checkSeen(int seen)
      Returns the number of arguments that is popped from the stack for the given opcode
    • detect

      protected void detect(int seen)
      Finds MET01 rule violating assertions.
      Specified by:
      detect in class AbstractAssertDetector