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

All switch statements should include a default option to catch any unspecified values.

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

Example(s):


public void bar() {
    int x = 2;
    switch (x) {
      case 1: int j = 6;
      case 2: int j = 8;
      				// missing default: here
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy