View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
2   
3   /** some javadoc. */
4   public class InputFormattedRightCurlySwitchCasesBlocks {
5   
6     /** some javadoc. */
7     public static void test0() {
8       int mode = 0;
9       switch (mode) {
10        case 1:
11          {
12            // violation above ''{' at column 9 should be on the previous line.'
13            int x = 1;
14            break;
15          }
16        case 2:
17          {
18            // violation above ''{' at column 9 should be on the previous line.'
19            int x = 0;
20            break;
21          }
22        default:
23      }
24    }
25  
26    /** some javadoc. */
27    public static void test() {
28      int mode = 0;
29      switch (mode) {
30        case 1:
31          {
32            // violation above ''{' at column 9 should be on the previous line.'
33            int x = 1;
34            break;
35          }
36        default:
37          int x = 0;
38      }
39    }
40  
41    /** some javadoc. */
42    public static void test1() {
43      int k = 0;
44      switch (k) {
45        case 1:
46          {
47            // violation above ''{' at column 9 should be on the previous line.'
48            int x = 1;
49          }
50          break;
51        case 2:
52          int x = 2;
53          break;
54        default:
55      }
56    }
57  
58    /** some javadoc. */
59    public static void test2() {
60      int mode = 0;
61      switch (mode) {
62        case 1:
63          int x = 1;
64          break;
65        case 2:
66          {
67            // violation above ''{' at column 9 should be on the previous line.'
68            break;
69          }
70        default:
71      }
72    }
73  
74    /** some javadoc. */
75    public static void test3() {
76      int k = 0;
77      switch (k) {
78        case 1:
79          {
80            // violation above ''{' at column 9 should be on the previous line.'
81            int x = 1;
82            break;
83          }
84        case 2:
85          {
86            // violation above ''{' at column 9 should be on the previous line.'
87            int x = 2;
88          }
89          break;
90        default:
91      }
92    }
93  }