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

9      private void foo(boolean debug) {
10         // ...
11         if (debug); { // print something
12             System.err.println("Enter foo");
13         }
14     }

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

Related checkers