View Javadoc
1   /*
2   SummaryJavadoc
3   violateExecutionOnNonTightHtml = (default)false
4   forbiddenSummaryFragments = @return the *|This method returns
5   period = (default).
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc;
11  
12  public class InputSummaryJavadocInlineForbidden {
13  
14      /**
15       * {@summary A simple correct Javadoc.}
16       */
17      void foo1() { // ok
18      }
19  
20      /**
21       * {@summary This code {@input Javadoc} is right.}
22       */
23      void foo3() { // ok
24      }
25      /**
26       * {@summary This code is wrong }
27       */ // violation above 'Summary .* missing an ending period.'
28      void foo5() {
29      }
30      /**
31       * {@summary This code {@see Javadoc} is wrong }
32       */ // violation above 'Summary .* missing an ending period.'
33      void foo6() {
34      }
35      /**
36       * {@summary As of , replaced by {@link #setBounds(int, int, int, int)}}
37       */ // violation above 'Summary .* missing an ending period.'
38      void foo11() {
39      }
40      /**
41       * {@summary This method returns something.}
42       */ // violation above 'Forbidden summary fragment.'
43      public static final byte NUL = 0;
44      /**
45       * {@summary <a href="mailto:vlad@htmlbook.ru"/>}
46       */ // violation above 'Summary javadoc is missing.'
47      class InnerInputCorrectJavaDocParagraphCheck {
48          /**
49           * {@summary foooo@foooo}
50           */ // violation above 'Summary .* missing an ending period.'
51          public static final byte NUL = 0;
52  
53          /**
54           * {@summary Some java@doc.}
55           */
56          public static final byte NUL_2 = 0; // ok
57          // violation 2 lines below 'Forbidden summary fragment.'
58          /**
59           * {@summary @return the
60           * customer ID some javadoc.}
61           */
62          int geId() {
63              return 666;
64          }
65  
66          /**
67           * {@summary As of JDK 1.1, replaced by {@link #setBounds(int, int, int, int)}.}
68           */
69          void foo3() {
70          } // ok
71  
72      }
73  
74      /**
75       * {@summary A {@code InnerInputCorrectJavaDocParagraphCheck} is a simple code.}
76       */
77      InputSummaryJavadocInlineForbidden.InnerInputCorrectJavaDocParagraphCheck anon =
78              new InputSummaryJavadocInlineForbidden.InnerInputCorrectJavaDocParagraphCheck() {
79                  // violation below 'First sentence .* missing an ending period.'
80                  /**
81                   * mm{@inheritDoc}
82                   */
83                  void foo7() {
84                  }
85  
86                  /**
87                   * {@summary {@code see}.}
88                   */
89                  void foo10() { // ok
90                  }
91              };
92      // violation 2 lines below 'Summary .* missing an ending period.'
93      /**
94       * {@summary first sentence is normally the summary.
95       * Use of html tags:
96       * {@throws error}
97       * <ul>
98       * <li>Item one.</li>
99       * <li>Item two.</li>
100      * </ul>
101      * <p> This is the paragraph.</p>
102      * <h1> This is a heading </h1>}
103      */
104     public void validInlineJavadoc()
105     {
106     }
107     /**
108      * {@summary <p> </p>}
109      */ // violation above 'Summary javadoc is missing.'
110     void foo12() {
111     }
112 
113     // violation below 'First sentence of Javadoc is missing an ending period'
114     /**
115      * Sentence starts as a plain text sentence
116      * {@summary ... but ends in the summary tag}
117      */
118     public class TestClass {}
119 
120     /**
121      * {@summary first sentence is normally the summary.}
122      *
123      * @param a some parameter.
124      * @return This method returns a, this statement is allowed in return.
125      */
126     public int validInlineJavadocReturn(int a) // ok
127     {
128         return a;
129     }
130 }