Class DefaultComesLastCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public class DefaultComesLastCheck
    extends AbstractCheck

    Check that the default is after all the cases in a switch statement.

    Rationale: Java allows default anywhere within the switch statement. But it is more readable if it comes after the last case.

    • Property skipIfLastAndSharedWithCase - Control whether to allow default along with case if they are not last. Type is boolean. Default value is false.

    Parent is com.puppycrawl.tools.checkstyle.TreeWalker

    Violation Message Keys:

    • default.comes.last
    • default.comes.last.in.casegroup
    Since:
    3.4