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 InputCommentsIndentationCommentIsAtTheEndOfBlockFour {
17  
18      public void foo45() {
19          int ar = 5;
20          // comment
21          ar = 6;
22           //violation '.* incorrect .* level 9, expected is 8, .* same .* as line 21.'
23      }
24  
25      public void foo46() {
26  // comment
27  // block
28  // violation '.* incorrect .* level 0, expected is 4, .* same .* as line 29.'
29      }
30  
31      public void foo47() {
32          int a = 5;
33          // comment
34          // block
35          // comment
36      }
37      public void foo48() {
38          int a = 5;
39  // comment
40  // block
41  // violation '.* incorrect .* level 0, expected is 8, .* same .* as line 38.'
42      }
43  
44      public void foo49() {
45          // comment
46          // block
47  
48      }
49  
50      public void foo50() {
51          return;
52  
53          // No NPE here!
54      }
55  
56      public String foo51() {
57          return String
58                  .valueOf("11"
59                  );
60           //violation '.* incorrect .* level 9, expected is 8, .* same .* as line 57.'
61      }
62  
63      public String foo52() {
64          return String
65                  .valueOf("11"
66                  );
67          // comment
68      }
69  
70      void foo53() {
71          // comment
72          new Object()
73                  .toString();
74          // comment
75      }
76  
77      void foo54() {
78          /* comment */
79          new Object()
80                  .toString();
81          // comment
82      }
83  
84      void foo55() {
85          //violation below '.* incorrect .* level 12, expected is 8, .* same .* as line 87.'
86              /* violation */
87          new Object()
88              .toString();
89              //violation '.* incorrect .* level 12, expected is 8, .* same .* as line 87.'
90      }
91  
92      void foo56() {
93          new Object().toString();
94          // comment
95      }
96  
97      void foo57() {
98          new Object().toString();
99              //violation '.* incorrect .* level 12, expected is 8, .* same .* as line 98.'
100     }
101 
102     void foo58() {
103         /*
104            comment
105            */
106         //violation '.* incorrect .* level 8, expected is 10, .* same .* as line 109.'
107 
108 
109           new InputCommentsIndentationCommentIsAtTheEndOfBlockOne().foo1();
110           //comment
111     }
112 
113     void foo59() {
114         new InputCommentsIndentationCommentIsAtTheEndOfBlockOne().foo1();
115         /*
116          comment */
117         // comment
118     }
119 }