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

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



SwitchStmtsShouldHaveDefault


SwitchStmtsShouldHaveDefault

Switch statements should have a default label.

This rule is defined by the following XPath expression:

                  
//SwitchStatement[not(SwitchLabel[@Default='true'])]
                  
              

Example:

                

public class Foo {
 public void bar() {
  int x = 2;
  switch (x) {
   case 2: int j = 8;
  }
 }
}

    
            




© 2015 - 2025 Weber Informatics LLC | Privacy Policy