1 package // violation 'package statement should not be line-wrapped.' 2 // violation below 'Javadoc comment is placed in the wrong location.' 3 /** invalid javadoc. */ 4 com.google.checkstyle.test.chapter7javadoc.rule711generalform; 5 6 // violation below 'Javadoc comment is placed in the wrong location.' 7 /** invalid javadoc. */ 8 import javax.swing.JFrame; 9 10 /** some javadoc. */ 11 public class InputFormattedSingleLineJavadocAndInvalidJavadocPosition { 12 13 /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ 14 void foo1() {} 15 16 /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ 17 void foo2() {} 18 19 // violation below 'Summary javadoc is missing.' 20 /** 21 * @throws CheckstyleException if a problem occurs 22 */ 23 void foo3() {} 24 25 /** 26 * summary. 27 * 28 * @throws CheckstyleException if a problem occurs 29 */ 30 void foo4() {} 31 32 /** An especially short bit of Javadoc. */ 33 void foo5() {} 34 35 /** An especially short bit of Javadoc. */ 36 void foo6() {} 37 38 // violation below 'Summary javadoc is missing.' 39 /** 40 * @inheritDoc 41 */ 42 void foo7() {} 43 44 /** {@inheritDoc} */ 45 void foo8() {} 46 47 // violation below 'Summary javadoc is missing.' 48 /** 49 * @customTag 50 */ 51 void bar() {} 52 53 /** 54 * summary. 55 * 56 * <h1>Some header </h1> 57 * 58 * {@inheritDoc} {@code bar1} text 59 */ 60 void bar2() {} 61 62 // violation below 'Summary javadoc is missing.' 63 /** 64 * @customTag <a> href="https://github.com/checkstyle/checkstyle/"</a>text 65 */ 66 void bar3() {} 67 68 /** Single line Javadoc that references {@link String}. */ 69 void bar4() {} 70 71 // violation below 'Summary javadoc is missing.' 72 /** 73 * @return in single line javadoc 74 */ 75 int bar5() { 76 return 0; 77 } 78 79 /** 80 * summary. 81 * 82 * @return in multi line javadoc 83 */ 84 int bar6() { 85 return 0; 86 } 87 } 88 89 // violation below 'Javadoc comment is placed in the wrong location.' 90 /** invalid javadoc. */ 91 /** valid javadoc. */ 92 class ExtraInputInvalidJavadocPosition { 93 // violation above '.* ExtraInputInvalidJavadocPosition has to reside in its own source file.' 94 // violation below 'Javadoc comment is placed in the wrong location.' 95 /** invalid javadoc. */ 96 } 97 98 /** valid javadoc. */ 99 /* ignore */ 100 class ExtraInputInvalidJavadocPosition2 { 101 // violation above '.* ExtraInputInvalidJavadocPosition2 has to reside in its own source file.' 102 // violation below 'Javadoc comment is placed in the wrong location.' 103 /** invalid javadoc. */ 104 static { 105 /* ignore */ 106 } 107 108 // violation below 'Javadoc comment is placed in the wrong location.' 109 /** invalid javadoc. */ 110 /** valid javadoc. */ 111 int field1; 112 113 /** valid javadoc. */ 114 int[] field2; 115 116 /** valid javadoc. */ 117 public int[] field3; 118 119 /** valid javadoc. */ 120 @Deprecated int field4; 121 122 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 123 int 124 /** invalid javadoc. */ 125 field20; 126 127 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 128 int field21 129 /** invalid javadoc. */ 130 ; 131 132 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 133 @Deprecated 134 /** invalid javadoc. */ 135 JFrame frame = new JFrame(); 136 137 void method1() {} 138 139 /** valid javadoc. */ 140 void method2() {} 141 142 /** valid javadoc. */ 143 <T> T method3() { 144 return null; 145 } 146 147 /** valid javadoc. */ 148 String[] method4() { 149 return null; 150 } 151 152 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 153 void 154 /** invalid javadoc. */ 155 method20() {} 156 157 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 158 void method21 159 /** invalid javadoc. */ 160 () {} 161 162 // 2 violations 2 lines above: 163 // ''method def lparen' has incorrect indentation level 6, expected .* 2.' 164 // ''(' should be on the previous line.' 165 166 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 167 void method22( 168 /** invalid javadoc. */ 169 ) {} 170 171 // violation 2 lines above ''method def rparen' has incorrect indentation level 6, expected .* 2.' 172 173 // 2 violations 4 lines below: 174 // '.* indentation should be the same level as line 178.' 175 // 'Javadoc comment is placed in the wrong location.' 176 void method23() 177 /** invalid javadoc. */ 178 {} 179 180 // violation 2 lines above ''method def lcurly' has incorrect indentation level 6, expected .* 4.' 181 182 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 183 void method24() { 184 /** invalid javadoc. */ 185 } 186 187 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 188 void method25() { 189 /** invalid javadoc. */ 190 int variable; 191 } 192 } 193 194 // violation 2 lines below '.* has to reside in its own source file.' 195 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 196 @Deprecated 197 /** invalid javadoc. */ 198 class ExtraInputInvalidJavadocPosition3 {} 199 200 // violation 2 lines below '.* has to reside in its own source file.' 201 /** valid javadoc. */ 202 @Deprecated 203 class ExtraInputInvalidJavadocPosition4 {} 204 205 // violation 2 lines below '.* has to reside in its own source file.' 206 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 207 class 208 /** invalid javadoc. */ 209 ExtraInputInvalidJavadocPosition5 {} 210 211 // violation 2 lines above '.* has incorrect indentation .* 0, expected .* 4.' 212 213 // violation 2 lines below '.* has to reside in its own source file.' 214 // violation 2 lines below 'Javadoc comment is placed in the wrong location.' 215 class ExtraInputInvalidJavadocPosition6 216 /** invalid javadoc. */ 217 {} 218 /** invalid javadoc. */ 219 // 2 violations 2 lines above: 220 // ''class def lcurly' has incorrect indentation level 0, expected level should be 2.' 221 // ''}' at column 2 should be alone on a line.' 222 // violation 4 lines above 'Javadoc comment is placed in the wrong location.'