View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle;
2   
3   /** some javadoc. */
4   public class InputFormattedCommentsIndentationInEmptyBlock {
5   
6     private void foo1() {
7       int a = 5;
8       int b = 3;
9       int v = 6;
10      if (a == b && v == b
11          || (a == 1
12  
13              /// // odd indentation comment
14              //
15              /*   // odd indentation comment
16               * one fine day ... */
17              && b == 1)) {
18        // Cannot clearly detect user intention of explanation target.
19      }
20    }
21  
22    private void foo2() {
23      int a = 5;
24      int b = 3;
25      int v = 6;
26      if (a == b && v == b || (a == 1 && b == 1)) {
27  
28        // comment
29      }
30    }
31  
32    private void foo3() {
33      int a = 5;
34      int b = 3;
35      int v = 6;
36      if (a == b && v == b || (a == 1 && b == 1)) {
37        // odd indentation comment
38      }
39    }
40  
41    // Comments here should be ok by Check
42    @SuppressWarnings("unused") // trailing
43    private static void foo4() { // trailing
44      if (true) { // trailing comment
45        // some comment
46      }
47      if (true) { // trailing comment
48      }
49    }
50  
51    // Comments here should be ok by Check
52    @SuppressWarnings("unused") // trailing
53    private static void foo5() { // trailing
54      if (true) { // trailing comment
55  
56        // odd indentation comment
57      }
58      if (true) { // trailing comment
59      }
60    }
61  
62    /** some javadoc. */
63    public void foo6() {
64      try {
65        /* foo */
66      } catch (Exception e) {
67        // odd indentation comment
68      }
69    }
70  
71    /** some javadoc. */
72    public void foo7() {
73      try {
74        /* foo */
75      } catch (Exception e) {
76        // OOOO: handle exception here
77      }
78    }
79  
80    private static class MyClass extends Object {
81      // no members
82    }
83  }