Class InefficientInitializationInsideLoop

    • Field Detail

      • NODELIST_GET_LENGTH

        private static final MethodDescriptor NODELIST_GET_LENGTH
      • STRING_REPLACEFIRST

        private static final MethodDescriptor STRING_REPLACEFIRST
      • implicitPatternMethods

        private static final java.util.Set<MethodDescriptor> implicitPatternMethods
      • matched

        private java.util.SortedMap<java.lang.Integer,​BugInstance> matched
      • conditions

        private java.util.SortedMap<java.lang.Integer,​java.lang.Integer> conditions
      • sources

        private java.util.SortedMap<java.lang.Integer,​java.lang.Integer> sources
    • Constructor Detail

      • InefficientInitializationInsideLoop

        public InefficientInitializationInsideLoop​(BugReporter bugReporter)
    • Method Detail

      • visitMethod

        public void visitMethod​(org.apache.bcel.classfile.Method obj)
        Specified by:
        visitMethod in interface org.apache.bcel.classfile.Visitor
        Overrides:
        visitMethod in class BetterVisitor
      • isFastPath

        private boolean isFastPath​(java.lang.String regex)
        Since JDK 1.7 there's a special branch in String.split which works very fast for one-character pattern We do not report a bug if this case takes place (in fact precompilation will make split much slower since this fast path doesn't use regexp engine at all)
        Parameters:
        regex - regex to test whether it's suitable for the fast path
        Returns:
        true if fast path is possible
      • getFirstArgument

        private java.lang.String getFirstArgument()
        Returns:
        first argument of the called method if it's a constant
      • hasConstantArguments

        private boolean hasConstantArguments()
        Returns:
        true if only constants are passed to the called method