View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Input test file for testing empty LITERAL_CASE.
3   // Created: 2017
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.puppycrawl.tools.checkstyle.checks.blocks.emptyblock;
6   
7   class InputEmptyBlockCase
8   {
9       void method1(int a) {
10          switch (a) {}
11          switch (a) {case 1: ; } // no violation
12          switch (a) {case 1:{}}  // 1 violation
13          switch (a) {
14              case 1:
15          }
16          switch (a) {
17              case 1: // 1 violation
18              {}
19          }
20          switch (a) {
21              case 1: // 1 violation if checking statements
22              {// none if checking text
23              }
24          }
25      }
26  
27      public void method2(char c) {
28          switch(c) { case 0: } // no violation
29          switch(c) { case 0: {} method1(1); } // 1 violation
30          switch(c) { case 0: method1(0); {} } // no violation
31          switch(c) { case 0: case 1: {} } // 1 violation
32          switch(c) { case 0: {} case 1: {// 2 violations if checking statements
33          }
34          }
35      }
36  }