View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="MissingSwitchDefault"/>
5     </module>
6   </module>
7   */
8   package com.puppycrawl.tools.checkstyle.checks.coding.missingswitchdefault;
9   
10  // xdoc section -- start
11  class Example1 {
12    void Example1(int i) {
13      switch (i) { // violation, 'switch without "default" clause'
14        case 1:
15          break;
16        case 2:
17          break;
18      }
19    }
20    enum Status {ACTIVE, DISABLED}
21    void testEnum(Status status) {
22      switch (status) { // violation, 'switch without "default" clause'
23        case ACTIVE:
24          System.out.println(0);
25          break;
26        case DISABLED:
27          System.out.println(1);
28          break;
29      }
30    }
31  }
32  // xdoc section -- end