All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.pmd.EmptyStatementNotInLoop.html Maven / Gradle / Ivy



EmptyStatementNotInLoop

EmptyStatementNotInLoop

An empty statement (or a semicolon by itself) that is not used as the sole body of a ‘for’ or ‘while’ loop is probably a bug. It could also be a double semicolon, which has no purpose and should be removed.


//EmptyStatement
 [not(
       ../../../ForStatement
       or ../../../WhileStatement
       or ../../../BlockStatement/ClassOrInterfaceDeclaration
       or ../../../../../../ForStatement/Statement[1]
        /Block[1]/BlockStatement[1]/Statement/EmptyStatement
       or ../../../../../../WhileStatement/Statement[1]
        /Block[1]/BlockStatement[1]/Statement/EmptyStatement)
 ]

Example(s):


public void doit() {
      // this is probably not what you meant to do
      ;
      // the extra semicolon here this is not necessary
      System.out.println("look at the extra semicolon");;
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy