edu.umd.cs.findbugs.detect

Class FindUselessControlFlow

  • All Implemented Interfaces:
    Detector, Priorities, StatelessDetector, Constants2, Cloneable, org.apache.bcel.classfile.Visitor, org.apache.bcel.Constants


    public class FindUselessControlFlow
    extends BytecodeScanningDetector
    implements StatelessDetector
    A Detector to look for useless control flow. For example,
     if (argv.length == 1)
         ;
     System.out.println("Hello, " + argv[0]);
     
    In this kind of bug, we'll see an ifcmp instruction where the IF target is the same as the fall-through target.

    The idea for this detector came from Richard P. King, and the idea of looking for if instructions with identical branch and fall-through targets is from Mike Fagan.

    Author:
    David Hovemeyer
    • Constructor Detail

      • FindUselessControlFlow

        public FindUselessControlFlow(BugReporter bugReporter)
    • Method Detail

      • visit

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

        public static int getNextSourceLine(org.apache.bcel.classfile.LineNumberTable lineNumbers,
                            int sourceLine)

Copyright © 2003–2015. All rights reserved.