001: ////////////////////////////////////////////////////////////////////////////////
002: // Test case file for checkstyle.
003: // Created: 2003
004: ////////////////////////////////////////////////////////////////////////////////
005:
006: package com.puppycrawl.tools.checkstyle;
007:
008: /**
009: * Test input for the JavadocStyleCheck. This check is used to perform
010: * some additional Javadoc validations.
011: *
012: * @author Chris Stillwell
013: * @version 1.0
014: */
015: public class InputJavadocStyleCheck {
016: // This is OK. We don't flag missing javadoc. That's left for other checks.
017: private String first;
018:
019: /** This Javadoc is missing an ending period */
020: private String second;
021:
022: /**
023: * We don't want {@link com.puppycrawl.tools.checkstyle.checks.JavadocStyleCheck}
024: * tags to stop the scan for the end of sentence.
025: * @see Somthing
026: */
027: public InputJavadocStyleCheck() {
028: }
029:
030: /**
031: * This is ok!
032: */
033: private void method1() {
034: }
035:
036: /**
037: * This is ok?
038: */
039: private void method2() {
040: }
041:
042: /**
043: * And This is ok.<br>
044: */
045: private void method3() {
046: }
047:
048: /**
049: * This should fail even.though.there are embedded periods
050: */
051: private void method4() {
052: }
053:
054: /**
055: * Test HTML in Javadoc comment
056: * <dl>
057: * <dt><b>This guy is missing end of bold tag
058: * <dd>The dt and dd don't require end tags.
059: * </dl>
060: * </td>Extra tag shouldn't be here
061: *
062: * @param arg1 <code>dummy.
063: */
064: private void method5(int arg1) {
065: }
066:
067: /**
068: * Protected check <b>should fail
069: */
070: protected void method6() {
071: }
072:
073: /**
074: * Package protected check <b>should fail
075: */
076: void method7() {
077: }
078:
079: /**
080: * Public check should fail</code>
081: * should fail <
082: */
083: public void method8() {
084: }
085:
086: /** {@inheritDoc} **/
087: public void method9() {
088: }
089:
090: // Testcases to excercize the Tag parser (bug 843887)
091:
092: /**
093: * Real men don't use XHTML.
094: * <br />
095: * <hr/>
096: * < br/>
097: * <img src="schattenparker.jpg"/></img>
098: */
099: private void method10() { // </img> should be the only error
100: }
101:
102: /**
103: * Tag content can be really mean.
104: * <p>
105: * Sometimes a p tag is closed.
106: * </p>
107: * <p>
108: * Sometimes it's not.
109: *
110: * <span style="font-family:'Times New Roman',Times,serif;font-size:200%">
111: * Attributes can contain spaces and nested quotes.
112: * </span>
113: * <img src="slashesCanOccurWithin/attributes.jpg"/>
114: * <img src="slashesCanOccurWithin/attributes.jpg">
115: * <!-- comments <div> should not be checked. -->
116: */
117: private void method11() { // JavadocStyle should not report any error for this method
118: }
119:
120: /**
121: * Tags for two lines.
122: * <a href="some_link"
123: * >Link Text</a>
124: */
125: private void method12() {// JavadocStyle should not report any error for this method
126: }
127:
128: /**
129: * First sentence.
130: * <pre>
131: * +--LITERAL_DO (do)
132: * |
133: * +--SLIST ({)
134: * |
135: * +--EXPR
136: * |
137: * +--ASSIGN (=)
138: * |
139: * +--IDENT (x)
140: * +--METHOD_CALL (()
141: * |
142: * +--DOT (.)
143: * |
144: * +--IDENT (rand)
145: * +--IDENT (nextInt)
146: * +--ELIST
147: * |
148: * +--EXPR
149: * |
150: * +--NUM_INT (10)
151: * +--RPAREN ())
152: * +--SEMI (;)
153: * +--RCURLY (})
154: * +--LPAREN (()
155: * +--EXPR
156: * |
157: * +--LT (<)
158: * |
159: * +--IDENT (x)
160: * +--NUM_INT (5)
161: * +--RPAREN ())
162: * +--SEMI (;)
163: * </pre>
164: */
165: private void method13() {// JavadocStyle should not report any error for this method
166: }
167:
168: /**
169: * Some problematic javadoc. Sample usage:
170: * <blockquote>
171: */
172:
173: private void method14() { // empty line between javadoc and method is critical (bug 841942)
174: }
175:
176: /**
177: * Empty line between javadoc and method declaration cause wrong
178: * line number for reporting error (bug 841942)
179: */
180:
181: private void method15() { // should report unended first sentance (check line number of the error)
182: }
183:
184: /** Description of field: {@value}. */
185: public static final int dummy = 4911;
186:
187: /**
188: */
189: public void method16() { // should report empty javadoc
190: }
191:
192: /**
193: * @param a A parameter
194: */
195: protected void method17(String a) { // should report empty javadoc (no text before parameter)
196: }
197:
198: /**
199: * @exception RuntimeException shoul be thrown
200: */
201: void method18(String a) { // should report empty javadoc (no text before exception)
202: }
203:
204: /**
205: */
206: private static int ASDF = 0;
207:
208: // should report empty javdoc
209:
210: /** @see java.lang.Object */
211: public void method19() { // should report empty javadoc (no text before see tag)
212: }
213:
214: public enum Test
215: //Should complain about no javadoc
216: {
217: /**
218: * Value 1 without a period
219: */
220: value1,
221:
222: /**
223: * Value 2 with a period.
224: */
225: value2,
226: }
227:
228: /**
229: * A test class.
230: * @param <T1> this is NOT an unclosed T1 tag
231: * @author <a href="mailto:foo@nomail.com">Foo Bar</a>
232: */
233: public class TestClass<T1> {
234: /**
235: * Retrieves X.
236: * @return a value
237: */
238: public T1 getX() {
239: return null;
240: }
241:
242: /**
243: * Retrieves Y.
244: * @param <V> this is not an unclosed V tag
245: * @return a value
246: */
247: public <V> V getY() {
248: return null;
249: }
250: }
251:
252: /**
253: * Checks if the specified IClass needs to be
254: * annotated with the @Type annotation.
255: */
256: public void foo_1291847_1() {
257: }
258:
259: /**
260: * Returns the string containing the properties of
261: * <code>@Type</code> annotation.
262: */
263: public void foo_1291847_2() {
264: }
265:
266: }
|