View Javadoc
1   /*
2   TrailingComment
3   format = (default)^[\s});]*$
4   legalComment = (default)(null)
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.trailingcomment;
10  
11  public class InputTrailingComment {
12      // violation below
13      int i; // don't use trailing comments :)
14      // it fine to have comment w/o any statement
15      /* good c-style comment. */
16      // violation below
17      int j; /* bad c-style comment. */
18      // violation below
19      void method1() { /* some c-style multi-line
20                          comment*/
21          Runnable r = (new Runnable() {
22                  public void run() {
23                  }
24              }); /* we should allow this */
25      } // we should allow this
26      /*
27        Let's check multi-line comments.
28      */
29      // violation below
30      /* c-style */ // cpp-style
31      /* c-style 1 */ /*c-style 2 */
32       // violation above
33      /* package */ void method2(long ms /* we should ignore this */) {
34          /* comment before text */int z;
35          /* int y */int y/**/;
36      }
37  
38      /**
39       * comment with trailing space.
40       */
41      // violation below
42      final static public String NAME="Some Name"; // NOI18N
43       // violation below
44      final static public String NAME2="Some Name"; /*NOI18N*/
45       // violation below
46      String NAME3="Some Name"; /*NOI18N
47  */
48      /* package */ void method3() {
49          /* violation on this block */
50          // violation here for format NOT FOUND
51      }
52  
53      private static class TimerEntry {
54          /* ok */ final String operation = null;
55          /* ok */ final long start = 0L;
56      }
57  
58      /**
59       * violation above this line.
60       **/
61      /* package */ void addError() {
62      }
63  }