SBCCS - Supply Break or Comment in Case Statement
According to Sun Code Conventions for Java, every time a case falls through (doesn't include a break statement), a comment should be added where the break statement would normally be. The break in the default case is redundant, but it prevents a fall-through error if later another case is added.
Wrong
case 'n':
result += '\n';
break;
case 'r':
result += '\r';
break;
case '\'':
someFlag = true;
case '\"':
result += c;
break;
// some more code...
}
Tip:
Add /* falls through */ comment where the break statement would normally be.
Right
case 'n':
result += '\n';
break;
case 'r':
result += '\r';
break;
case '\'':
someFlag = true;
/* falls through */;
case '\"':
result += c;
break;
// some more code...
}