resources.report.rules.pmd.EmptyStatementNotInLoop.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sanity4j Show documentation
Show all versions of sanity4j Show documentation
Sanity4J was created to simplify running multiple static code
analysis tools on the Java projects. It provides a single entry
point to run all the selected tools and produce a consolidated
report, which presents all findings in an easily accessible
manner.
The newest version!
EmptyStatementNotInLoop
EmptyStatementNotInLoop
An empty statement (aka a semicolon by itself) that is not used
as the sole body of a for loop or while loop is probably a bug. It
could also be a double semicolon, which is useless and should be
removed.
This rule is defined by the following XPath expression:
//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:
public class MyClass {
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");;
}
}