Class MissingSwitchDefaultCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public class MissingSwitchDefaultCheck
    extends AbstractCheck

    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 against later changes, e.g. introduction of new types in an enumeration type.

    An example of how to configure the check is:

     <module name="MissingSwitchDefault"/>
     
    Author:
    o_sukhodolsky