29 lines
788 B
Plaintext
29 lines
788 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
include::../noncompliant.adoc[]
|
||
|
|
||
|
include::../compliant.adoc[]
|
||
|
|
||
|
== Exceptions
|
||
|
|
||
|
This rule is relaxed in the following cases:
|
||
|
|
||
|
----
|
||
|
switch (myVariable) {
|
||
|
case 0: // Empty case used to specify the same behavior for a group of cases.
|
||
|
case 1:
|
||
|
doSomething();
|
||
|
break;
|
||
|
case 2: // Use of return statement
|
||
|
return;
|
||
|
case 3: // Use of throw statement
|
||
|
throw new IllegalStateException();
|
||
|
case 4: // Use of continue statement
|
||
|
continue;
|
||
|
default: // For the last case, use of break statement is optional
|
||
|
doSomethingElse();
|
||
|
}
|
||
|
----
|
||
|
|
||
|
include::../see.adoc[]
|