Class LazyInit

    • Constructor Detail

      • LazyInit

        public LazyInit​(BugReporter bugReporter)
    • Method Detail

      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface StatelessDetector
        Overrides:
        clone in class java.lang.Object
      • prescreen

        public boolean prescreen​(org.apache.bcel.classfile.Method method,
                                 ClassContext classContext)
        Description copied from class: ByteCodePatternDetector

        Prescreen a method. It is a valid, but dumb, implementation simply to return true unconditionally. A better implementation is to call ClassContext.getBytecodeSet() to check whether the method actually contains the bytecode instructions that the pattern will look for. The theory is that checking the bytecode set is very fast, while building the MethodGen, CFG, ValueNumberAnalysis, etc. objects required to match ByteCodePatterns is slow, and the bytecode pattern matching algorithm is also not particularly fast.

        As a datapoint, prescreening speeds up the BCPDoubleCheck detector by a factor of 5 with no loss of generality and only a dozen or so extra lines of code.

        Specified by:
        prescreen in class ByteCodePatternDetector
        Parameters:
        method - the method
        classContext - the ClassContext for the method
        Returns:
        true if the method should be analyzed for instances of the ByteCodePattern