Jump statements (return
, break
, continue
) and throw
expressions move control flow out of the
current code block. So any statements that come after a jump are dead code.
Noncompliant code example
Integer foo(Integer a) {
Integer i = 10;
return i + a; // Noncompliant
i++; // dead code
}
Compliant solution
Integer foo(Integer a) {
Integer i = 10;
return i + a; // Noncompliant
}