View Javadoc
1   /*
2   SummaryJavadoc
3   violateExecutionOnNonTightHtml = (default)false
4   forbiddenSummaryFragments = (default)^$
5   period = (default).
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc;
10  
11  class InputSummaryJavadocInlineReturn {
12      /**
13       * {@return a zero, note that no period is ok as it is set by javadoc tool}
14       */
15      private int returnFoo1() // ok
16      {
17          return 0;
18      }
19  
20      /**
21       * {@return a {@code 0}}
22       */
23      private int returnFoo2() // ok
24      {
25          return 0;
26      }
27  
28      /**
29       * Text before the return tag. {@return a {@code 0}}
30       */
31      private int returnFoo3() // ok, javadoc tool produces a warning
32      {
33          return 0;
34      }
35  
36      /**
37       * {@return a {@code 0}} Text after the return tag.
38       */
39      private int returnFoo4() // ok
40      {
41          return 0;
42      }
43  
44      /**
45       * {@return a {@code 0}
46       * there's more text on another line
47       * and even more lines}
48       */
49      private int returnMultiline() // ok
50      {
51          return 0;
52      }
53  
54      /**
55       * {@return a {@code 0}<br>
56       * there's more text on another line<br>
57       * and even more lines}
58       */
59      private int returnMultiline2() // ok
60      {
61          return 0;
62      }
63  
64      /**
65       * {@return nothing, this is a void method}
66       */
67      private void voidMethod() // ok, javadoc tool produces an error
68      {
69      }
70  
71      // the return tag is empty, which is not allowed
72      /**
73       // violation below 'Summary javadoc is missing.'
74       * {@return}
75       */
76      int returnNothing() {
77          return 0;
78      }
79  
80      /**
81       * {@return nothing, this is a field}
82       */
83      private static final byte NOT_A_METHOD = 0; // ok, javadoc tool produces an error
84  
85      /**
86       * {@return nothing, this is a class}
87       */
88      private class NotAMethod {} // ok, javadoc tool produces an error
89  }