View Javadoc
1   /*
2   CommentsIndentation
3   tokens = BLOCK_COMMENT_BEGIN
4   
5   
6   */
7   
8   // comment
9   package com.puppycrawl.tools.checkstyle.checks.indentation.commentsindentation;
10  
11  import java.util.Arrays;
12  
13  // some
14  public class InputCommentsIndentationSurroundingCode3One
15  {
16      private void foo1() {
17          if (true) {
18              // here initialize some variables
19              int k = 0; // trailing comment
20              int b = 10;
21              // sss
22          }
23      }
24  
25      private void foo2() {
26          if (true) {
27              /* some */
28              int k = 0;
29              // violation below '.* incorrect .* level 16, expected is 12, .* same .* as line 31.'
30                  /* some comment */
31              int b = 10;
32                  /* // violation '.* incorrect .* level 16, expected is 12, .* same .* as line 34.'
33                   * */
34              double d; /* trailing comment */
35                  /* // violation '.* incorrect .* level 16, expected is 12, .* same .* as line 38.'
36               *
37                  */
38              boolean bb;
39              /***/
40              /* my comment*/
41              /*
42               *
43               *
44               *  some
45               */
46              /*
47               * comment
48               */
49              boolean x;
50          }
51      }
52  
53      private void foo3() {
54          int a = 5, b = 3, v = 6;
55          if (a == b
56              && v == b || ( a ==1
57                         /* // violation '.* incorrect .* level 23, expected is 36, .* as line 59.'
58                          * one fine day ... */
59                                      && b == 1)   ) {
60          }
61      }
62  
63      private static void com() {
64          /* here's my weird trailing comment */ boolean b = true;
65      }
66  
67      private static final String[][] mergeMatrix = {
68          // This example of trailing block comments was found in PMD sources.
69          /* TOP */{ "", },
70          /* ALWAYS */{ "", "", },
71         /* NEVER */{ "NEVER", "UNKNOWN", "NEVER", },
72         /* UNKNOWN */{ "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN" }, };
73  
74      private void foo4() {
75          if (!Arrays.equals(new String[]{""}, new String[]{""})
76                /* wierd trailing comment */) {
77          }
78      }
79      /**
80       * some javadoc
81       */
82      private static void l() {
83      }
84  
85      public void foid5() {
86          String s = "";
87          s.toString().toString().toString();
88          // comment
89      }
90  
91      public void foo6() {
92                // comment
93                // ...
94                // block
95                // ...
96          String someStr = new String();
97      }
98  
99      public void foo7() {
100              // comment
101              // ...
102              // block
103         // comment
104         String someStr = new String();
105     }
106     // Test
107 }