View Javadoc
1   /*
2   LeftCurly
3   option = (default)EOL
4   ignoreEnums = (default)true
5   tokens = (default)ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, \
6            ENUM_DEF, INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, \
7            LITERAL_DEFAULT, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, \
8            LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, \
9            METHOD_DEF, OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF
10  
11  
12  */
13  
14  package com.puppycrawl.tools.checkstyle.checks.blocks.leftcurly;
15  
16  public class InputLeftCurlyTestEolSwitch {
17  
18      public void doStuff() {
19          int x = 1;
20          switch (x) {
21              case 0:
22              { // violation ''{' at column 13 should be on the previous line'
23                  break;
24              }
25              case (1+0):
26              { // violation ''{' at column 13 should be on the previous line'
27                  break;
28              }
29              case 2: {
30                  break;
31              }
32              default:
33              { // violation ''{' at column 13 should be on the previous line'
34                  break;
35              }
36              case 3:
37              case 4:
38                  x++;
39                  { // OK, standalone block
40                  }
41                  break;
42              case 5: {
43                  }
44                  break;
45              case (5
46                  +1):
47              { // violation ''{' at column 13 should be on the previous line'
48                  break;
49              }
50              case 7
51                  :
52              { // violation ''{' at column 13 should be on the previous line'
53                  break;
54              }
55          }
56          switch (x) {
57              case 0: {
58                  break;
59              }
60              default:
61                  // do nothing
62          }
63      }
64  
65      public @interface SomeAnnotation {
66  
67          String value() default "";
68  
69      }
70  
71      public interface SomeInterface {
72  
73          default String method() {
74              return null;
75          }
76      }
77  
78  }