View Javadoc
1   /*
2   CommentsIndentation
3   tokens = (default)SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN
4   
5   
6   */
7   package com.puppycrawl.tools.checkstyle.checks.indentation.commentsindentation;
8   
9   
10  
11  
12  
13  /**
14   * Contains examples of using comments at the end of the block.
15   */
16  public class InputCommentsIndentationCommentIsAtTheEndOfBlockThree {
17  
18      public void foo30() {
19          // comment
20          int a = 5;
21  //violation '.* incorrect .* level 0, expected is 8, .* same .* as line 20.'
22      }
23  
24      public void foo31() {
25          String s = new String ("A"
26                  + "B"
27                  + "C");
28          // comment
29      }
30  
31      public void foo32() {
32          String s = new String ("A"
33              + "B"
34              + "C");
35              //violation '.* incorrect .* level 12, expected is 8, .* same .* as line 32.'
36      }
37  
38      public void foo33() {
39          // comment
40          new InputCommentsIndentationCommentIsAtTheEndOfBlockTwo().foo22();
41  
42  //        violation '.* incorrect .* level 0, expected is 8, .* same .* as line 40.'
43      }
44  
45      public void foo34() throws Exception {
46          throw new Exception("",
47                  new Exception()
48          );
49          // comment
50      }
51  
52      public void foo35() throws Exception {
53          throw new Exception("",
54                  new Exception()
55          );
56              //violation '.* incorrect .* level 12, expected is 8, .* same .* as line 53.'
57      }
58  
59      public void foo36() throws Exception {
60          throw new Exception("",
61                  new Exception()
62          );
63  //      violation '.* incorrect .* level 0, expected is 8, .* same .* as line 60.'
64      }
65  
66      public void foo37() throws Exception {
67          throw new Exception("", new Exception());
68          // comment
69      }
70  
71      public void foo38() throws Exception {
72          throw new Exception("", new Exception());
73                //violation '.* incorrect .* level 14, expected is 8, .* same .* as line 72.'
74      }
75  
76      public void foo39() throws Exception {
77          throw new Exception("",
78                  new Exception());
79           //violation '.* incorrect .* level 9, expected is 8, .* same .* as line 77.'
80      }
81  
82      public void foo40() throws Exception {
83          int a = 88;
84          throw new Exception("", new Exception());
85           //violation '.* incorrect .* level 9, expected is 8, .* same .* as line 84.'
86      }
87  
88      public void foo41() throws Exception {
89          int a = 88;
90          throw new Exception("", new Exception());
91          // comment
92      }
93  
94      public void foo42() {
95          int a = 5;
96          if (a == 5) {
97              int b;
98              // comment
99          } else if (a ==6) {
100 
101         }
102     }
103     public void foo43() {
104         try {
105             int a;
106             // comment
107         } catch (Exception e) {
108 
109         }
110     }
111 
112     public void foo44() {
113         int ar = 5;
114         // comment
115         ar = 6;
116         // comment
117     }
118 
119 }