View Javadoc
1   /*
2   TrailingComment
3   format = (default)^[\s});]*$
4   legalComment = ^NOI18N$
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.trailingcomment;
10  
11  public class InputTrailingComment2 {
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      // violation below
32      /* c-style 1 */ /*c-style 2 */
33  
34      /* package */ void method2(long ms /* we should ignore this */) {
35          /* comment before text */int z;
36          /* int y */int y/**/;
37      }
38  
39      /**
40       * comment with trailing space.      */
41      // violation below
42      final static public String NAME="Some Name"; // NOI18N
43      final static public String NAME2="Some Name"; /*NOI18N*/
44      // violation below
45      String NAME3="Some Name"; /*NOI18N
46  */
47      /* package */ void method3() {
48          /* violation on this block */
49          // violation here for format NOT FOUND
50      }
51  
52      private static class TimerEntry {
53          /* ok */ final String operation = null;
54          /* ok */ final long start = 0L;
55      }
56  
57      /**
58       * violation above this line.
59       **/
60      /* package */ void addError() {
61      }
62  }