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

org.sonar.l10n.squidjava.rules.squid.S1219.html Maven / Gradle / Ivy

Even if it is legal, mixing case and non-case labels in the body of a switch statement is very confusing, and could mislead developers discovering this piece of code.

Noncompliant Code Example

switch (variable) {
  case 0:
    /* ... */
  myLabel:           // Noncompliant
    result = 0;
    break;
  case 1:
    /* ... */
  default:
    /* ... */
}

Compliant Solution

switch (variable) {
  case 0:
    /* ... */
    result = 0;
    break;
  case 1:
    /* ... */
  default:
    /* ... */
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy