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 InputCommentsIndentationInMultiblockStructuresOne {
11      void foo() {
12          if (true) {
13              assert true;
14          // comment for else
15          } else {}
16  
17          if (true) {
18              assert true;
19          // violation '.* incorrect .* level 8, expected is 12, .* same .* as line 18.'
20          }
21          else {}
22  
23          if (true) {
24              assert true;
25                  // violation '.* incorrect .* level 16, expected is 12, 8,.*same .* as line 24, 26.'
26          } else {}
27  
28          if (true) {
29              assert true;
30  // violation '.* incorrect .* level 0, expected is 12, 8, .* same .* as line 29, 31.'
31          } else {}
32  
33          try {
34              assert true;
35          // comment for catch
36          } catch (Exception ex) {}
37  
38          try {
39              assert true;
40          // violation '.* incorrect .* level 8, expected is 12, .* same .* as line 39.'
41          }
42          catch (Exception ex) {}
43  
44          try {
45              assert true;
46  // violation '.* incorrect .* level 0, expected is 12, 8, .* same .* as line 45, 47.'
47          } catch (Exception ex) {}
48  
49          try {
50              assert true;
51                  // violation '.* incorrect .* level 16, expected is 12, 8,.* same.* as line 50, 52.'
52          } catch (Exception ex) {}
53  
54          try {
55              assert true;
56          // comment for finally
57          } finally {}
58  
59          try {
60              assert true;
61          // violation '.* incorrect .* level 8, expected is 12, .* same .* as line 60.'
62          }
63          finally {}
64  
65          try {
66              assert true;
67  // violation '.* incorrect .* level 0, expected is 12, 8, .* same .* as line 66, 68.'
68          } finally {}
69  
70          try {
71              assert true;
72                  // violation '.* incorrect .* level 16, expected is 12, 8,.* same.* as line 71, 73.'
73          } finally {}
74  
75          try {} catch (Exception ex) {
76              assert true;
77          // comment for finally
78          } finally {}
79  
80          try {} catch (Exception ex) {
81              assert true;
82          // violation '.* incorrect .* level 8, expected is 12, .* same .* as line 81.'
83          }
84          finally {}
85  
86          try {} catch (Exception ex) {
87              assert true;
88  // violation '.* incorrect .* level 0, expected is 12, 8, .* same .* as line 87, 89.'
89          } finally {}
90  
91          try {} catch (Exception ex) {
92              assert true;
93                  // violation '.* incorrect .* level 16, expected is 12, 8,.*same.* as line 92, 94.'
94          } finally {}
95  
96          try {} catch (ClassCastException ex) {
97              assert true;
98          // comment for catch
99          } catch (Exception ex) {}
100 
101         try {} catch (ClassCastException ex) {
102             assert true;
103         // violation '.* incorrect .* level 8, expected is 12, .* same .* as line 102.'
104         }
105         catch (Exception ex) {}
106 
107         try {} catch (ClassCastException ex) {
108             assert true;
109 // violation '.* incorrect .* level 0, expected is 12, 8, .* same .* as line 108, 110.'
110         } catch (Exception ex) {}
111 
112         try {} catch (ClassCastException ex) {
113             assert true;
114                 // violation '.* incorrect .* level 16, expected is 12, 8,.*same.*as line 113, 115.'
115         } catch (Exception ex) {}
116 
117     }
118 }