View Javadoc
1   /*
2   RightCurly
3   option = ALONE
4   tokens = LITERAL_SWITCH, LITERAL_IF
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
10  
11  public class InputRightCurlyTestSwitchCase3 {
12  
13      public void method() {
14          int x = 0;
15          switch (x) { } // violation ''}' at column 22 should be alone on a line'
16          switch (x) {
17          } int a; // violation ''}' at column 9 should be alone on a line'
18          switch (x) {
19              case(1): x = 0; break; } // violation ''}' at column 36 should be alone on a line'
20          switch (x)
21          {
22          }
23          switch (x)
24          {case(1): x=1;break;
25          } int b; // violation ''}' at column 9 should be alone on a line'
26          switch (x) {case(2): break; } int c;
27          // violation above ''}' at column 37 should be alone on a line'
28          switch (x) { } int d; // violation ''}' at column 22 should be alone on a line'
29          switch (x) { } // violation ''}' at column 22 should be alone on a line'
30      }
31  
32      public void someMethod() {
33          int x = 90;
34          if (7>x) {
35             switch (x) {
36                 case(1):
37                     break;}} // 2 violations
38      }
39  
40      public void someMethod2() {
41          int x = 90;
42          if (7>x) {
43             switch (x) { case(1): break;}} // 2 violations
44      }
45  
46      public void someMethod3() {
47          int x = 90;
48          if (7>x) {switch (x) {case(1): break;}
49          } // violation above ''}' at column 46 should be alone on a line'
50          if (7>x) {switch (x) { }} // 2 violations
51          if (7>x) {switch (x) {
52              }} // 2 violations
53          if (7>x) {switch (x) {
54              }
55         }
56         if (7>x) {switch (x) {
57              }
58         }
59      }
60  }