
org.sonar.l10n.java.rules.squid.AvoidBreakOutsideSwitch.html Maven / Gradle / Ivy
The use of the 'break' branching statement increases the
essential complexity of the source code and so prevents any refactoring
of this source code to replace all well structured control structures
with a single statement.
For instance, with the following java program fragment, it's not
possible to apply the 'extract method' refactoring pattern :
mylabel : for (int i = 0 ; i< 3; i++) {
for (int j = 0; j < 4 ; j++) {
doSomething();
if (checkSomething()) {
break mylabel;
}
}
}
The use of the 'break' branching statement is only authorized
inside a 'switch' statement.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy