View Javadoc
1   package // violation 'package statement should not be line-wrapped.'
2       /** odd javadoc */
3       // violation above 'Javadoc comment is placed in the wrong location.'
4       com.google.checkstyle.test.chapter7javadoc.rule734nonrequiredjavadoc;
5   
6   // violation below 'Javadoc comment is placed in the wrong location.'
7   /** odd javadoc */
8   import javax.swing.JFrame;
9   
10  // violation below 'Javadoc comment is placed in the wrong location.'
11  /** odd javadoc */
12  /** valid javadoc. */
13  class InputFormattedInvalidJavadocPosition {
14    /** odd javadoc */
15    // violation above 'Javadoc comment is placed in the wrong location.'
16  }
17  
18  /** valid javadoc. */
19  /* ignore */
20  class ExtraInputInvalidJavadocPosition2 {
21    // violation above '.* ExtraInputInvalidJavadocPosition2 has to reside in its own source file.'
22  
23    /** odd javadoc */
24    // violation above 'Javadoc comment is placed in the wrong location.'
25    static {
26      /* ignore */
27    }
28  
29    // violation below 'Javadoc comment is placed in the wrong location.'
30    /** odd javadoc */
31    /** valid javadoc. */
32    int field1;
33  
34    /** valid javadoc. */
35    JFrame frame = new JFrame();
36  
37    /** valid javadoc. */
38    public int[] field3;
39  
40    /** valid javadoc. */
41    @Deprecated int field4;
42  
43    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
44    int
45        /** odd javadoc */
46        field20;
47  
48    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
49    int field21
50        /** odd javadoc */
51        ;
52  
53    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
54    @Deprecated
55    /** odd javadoc */
56    int field22;
57  
58    void method1() {}
59  
60    /** valid javadoc. */
61    void method2() {}
62  
63    /** valid javadoc. */
64    <T> T method3() {
65      return null;
66    }
67  
68    /** valid javadoc. */
69    String[] method4() {
70      return null;
71    }
72  
73    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
74    void
75        /** odd javadoc */
76        method20() {}
77  
78    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
79    void method21
80        /** odd javadoc */
81        () {}
82  
83    // 2 violations 2 lines above:
84    //  '.* incorrect indentation level 6, expected level should be 2.'
85    //  ''(' should be on the previous line.'
86  
87    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
88    void method22(
89        /** odd javadoc */
90        ) {} // violation '.* incorrect indentation level 6, expected level should be 2.'
91  
92    // 2 violations 4 lines below:
93    //  '.* indentation should be the same level as line 97.'
94    //  'Javadoc comment is placed in the wrong location.'
95    void method23()
96          /** odd javadoc */
97        {} // violation '.* has incorrect indentation level 6, expected level should be 4.'
98  
99    // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
100   void method24() {
101     /** odd javadoc */
102   }
103 
104   // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
105   void method25() {
106     /** odd javadoc */
107     int variable;
108   }
109 
110   @Deprecated
111   /** odd javadoc */
112   // violation above 'Javadoc comment is placed in the wrong location.'
113   class InputInvalidJavadocPosition3 {}
114 
115   /** valid javadoc. */
116   @Deprecated
117   class InputInvalidJavadocPosition4 {}
118 
119   // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
120   class
121   /** odd javadoc */
122   InputInvalidJavadocPosition5 {}
123 
124   // violation 2 lines above '.* incorrect indentation .* 2, expected .* 6.'
125 
126   /* extra violation 4 line below until https://github.com/google/google-java-format/issues/1126 */
127   // violation 2 lines below 'Javadoc comment is placed in the wrong location.'
128   class InputInvalidJavadocPosition6
129   /** odd javadoc */
130   {}
131   // 2 violations above:
132   //  ''class def lcurly' has incorrect indentation level 2, expected level should be 4.'
133   //  ''}' at column 4 should be alone on a line.'
134   /** odd javadoc */
135   // violation above 'Javadoc comment is placed in the wrong location.'
136 }