com.puppycrawl.tools.checkstyle.checks.coding
public class MissingSwitchDefaultCheck extends DescendantTokenCheck
Checks that switch statement has "default" clause.
Rationale: It's usually a good idea to introduce a default case in every switch statement. Even if the developer is sure that all currently possible cases are covered, this should be expressed in the default branch, e.g. by using an assertion. This way the code is protected aginst later changes, e.g. introduction of new types in an enumeration type.
An example of how to configure the check is:
<module name="MissingSwitchDefault"/>
Constructor Summary | |
---|---|
MissingSwitchDefaultCheck() Creates new instance of the check. |
Method Summary | |
---|---|
int[] | getAcceptableTokens() {@inheritDoc} |
int[] | getDefaultTokens() {@inheritDoc} |