Why does it happen?
Java Language Specification says that:
The Empty Statement
An empty statement does nothing.
EmptyStatement: ;Execution of an empty statement always completes normally
It essentially means that you want to execute empty statement if a==b
if(a == b);
What should you do:
There are two main solutions to this problem:
-
You can avoid problems with empty statement by using code formatter
and surrounding stuff insideifwith{and}. By doing this
Your empty statement will be much more readable.if(a == b){ ; } -
You can also check tools used for static code analysis such as:

- Findbugs
- Checkstyle
- Pmd
They can instantly highlight problems such as this one.
I would recommend to combine both solutions.