JD.IFBAD

JD.IFBAD happens when an 'if' statement has only an empty 'then' branch. Possible misplaced ";".

Vulnerability and risk

Usually JD.IFBAD represents a logical error in the code. When there is a misplaced semicolon, the following statement is assumed to be executed only on condition but, in fact, is always executed. In less severe cases, it is just left-over code and should be removed for efficiency.

Mitigation and prevention

Change the code so that the 'if' contains a non-empty branch or remove the 'if' altogether.

Example 1

Copy
      private void foo(boolean debug) {
         // ...
         if (debug); { // print something
             System.err.println("Enter foo");
         }
     }

JD.IFBAD is reported for line 11: Redundant 'if' statement. The cause is probably a misplaced semicolon.

Related checkers