EmptyStatement

Since Checkstyle 3.1

Description

Detects empty statements (standalone ";" semicolon). Empty statements often introduce bugs that are hard to spot

Examples

To configure the check:

<module name="Checker">
  <module name="TreeWalker">
    <module name="EmptyStatement"/>
  </module>
</module>
        

Example:

public class Example1 {
  public void foo() {
    int i = 5;
    if(i > 3); // violation
    i++;
    for (i = 0; i < 5; i++); // violation
    i++;
    while (i > 10)
      i++;
  }
}
        

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Package

com.puppycrawl.tools.checkstyle.checks.coding

Parent Module

TreeWalker