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 InputCommentsIndentationInSwitchBlockFour {
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 foo13() {
28          int a = 5;
29          switch (a) {
30              case 1:
31                  /* comment */
32              case 2:
33                  hashCode();
34             /* // violation '.* incorrect .* level 11, expected is 16, 12, .* as line 33, 37.'
35              violation
36              */
37              case 3: // comment
38                  hashCode();
39             // violation '.* incorrect .* level 11, expected is 16, 12,.* same .* as line 38, 40.'
40              case 4: // comment
41                  if (true) {
42  
43                  }
44                  else {
45  
46                  }
47                  // comment
48              case 5:
49                  String s = ""
50                      + 1
51                      + "123";
52                  break;
53                  // comment
54              case 6:
55                  String q = ""
56                      + 1
57                      + "123";
58                  // comment
59              case 7:
60                  break;
61          }
62      }
63  
64      public void foo14() {
65          int a = 1;
66          switch (a) {
67              case 1:
68              default:
69  // violation '.* incorrect .* level 0, expected is 8, .* same .* as line 70.'
70          }
71      }
72  
73      public void foo15() {
74          int a = 1;
75          switch (a) {
76              case 1:
77              default:
78          // comment
79          }
80      }
81  }