EmptyWhileStmt

Empty While Statement finds all instances where a while statement does nothing. If it is a timing loop, then you should use Thread.sleep() for it; if it's a while loop that does a lot in the exit expression, rewrite it to make it clearer.

This rule is defined by the following XPath expression:


//WhileStatement/Statement[./Block[count(*) = 0]  or ./EmptyStatement]

              

Example:

                
  
public class Foo {
 void bar(int a, int b) {
  while (a == b) {
   // empty!
  }
 }
}