View Javadoc
1   /*
2   CommentsIndentation
3   tokens = (default)SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN
4   
5   
6   */
7   
8   package com.puppycrawl.tools.checkstyle.checks.indentation.commentsindentation;
9   
10  public class InputCommentsIndentationInSwitchBlockThree {
11  
12      private static void foo1() {
13          if (true) {
14              switch(1) {
15                  case 0:
16  
17                  case 1:
18                          // violation '.* incorrect .* level 24, expected is 20,.*same.* as line 19.'
19                      int b = 10;
20                  default:
21                   // comment
22              }
23  
24          }
25      }
26  
27      public void foo7() {
28          int a = 2;
29          String s = "";
30          switch (a) {
31              // comment
32              // comment
33              // comment
34              case 1:
35              case 2:
36                  // comment
37                  // comment
38                  foo1();
39                  // comment
40              case 3:
41                  // comment
42                  // comment
43                  // comment
44              case 4:
45      // violation '.* incorrect .* level 4, expected is 12, 12, .* same .* as line 44, 46.'
46              case 5:
47                  s.toString().toString().toString();
48                        // violation '.*incorrect.* level 22, expected is 16, 12,.*as line 47, 51.'
49                      // violation '.* incorrect .* level 20, expected is 16, 12,.*as line 47, 51.'
50                   // violation '.* incorrect .* level 17, expected is 16, 12, .* as line 47, 51.'
51              default:
52          }
53      }
54  
55      public void foo8() {
56          int a = 2;
57          String s = "";
58          switch (a) {
59              // comment
60              // comment
61              // comment
62              case 1:
63              case 2:
64                  // comment
65                  // comment
66                  foo1();
67                  // comment
68              case 3:
69                  // comment
70                  // comment
71                  s.toString().toString().toString();
72                  // comment
73              case 4:
74        // violation '.* incorrect .* level 6, expected is 12, 12, .* same .* as line 73, 75.'
75              default:
76          }
77      }
78  
79      public void foo9() {
80          int a = 5;
81          switch (a) {
82              case 1:
83              case 2:
84                  // comment
85          }
86      }
87  
88      public void foo10() {
89          int a = 5;
90          switch (a) {
91              case 1:
92              default:
93                  // comment
94          }
95      }
96  
97      public void foo11() {
98          int a = 5;
99          switch (a) {
100             case 1:
101             case 2:
102                 // comment
103         }
104     }
105 
106     public void foo12() {
107         int a = 5;
108         switch (a) {
109             // comment
110             case 1:
111         }
112     }
113 }