View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="TrailingComment">
5         <property name="format" value="^\s*$"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.trailingcomment;
12  
13  import java.util.Random;
14  
15  // xdoc section -- start
16  public class Example2 {
17    public static void main(String[] args) {
18      int x = new Random().nextInt(100);
19      // OK
20      if (/* OK, this comment does not end the line */ x > 5) {}
21      int a = 5; // violation, line content before comment should match pattern "^\s*$"
22      doSomething(
23              "param1"
24      ); // violation, line content before comment should match pattern "^\s*$"
25    }
26  
27    private static void doSomething(String param) {
28    }
29  }
30  // xdoc section -- end