View Javadoc
1   /*
2   SummaryJavadoc
3   violateExecutionOnNonTightHtml = (default)false
4   forbiddenSummaryFragments = (default)^$
5   period = (default).
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.javadoc.summaryjavadoc;
11  
12  class InputSummaryJavadocInlineCorrect {
13  
14      /**
15       * {@summary Simple JavaDoc. }
16       */
17      private void foo1() {} // ok
18  
19      /**
20       * {@summary {@code ABC} Javadoc.}
21       */
22      private void foo2() {} // ok
23  
24      /**
25       * {@summary {@code ABC} Javadoc {@code some defination}.}
26       */
27      private void foo3() {} // ok
28  
29      /**
30       * {@summary , *. }
31       */
32      private void foo4() {} // ok
33  
34      /**
35       * {@summary first sentence is normally the summary.
36       * Use of html tags:
37       * <ul>
38       * <li>Item one.</li>
39       * <li>Item two.</li>
40       * </ul>}
41       */
42      private void validInlineJavadocWithList() // ok
43      {
44      }
45  
46      /**
47       * {@summary first sentence is normally the summary.
48       * Use of html tags:
49       * {@code SomeCodeHere.}
50       * <ul>
51       * <li>Item one.</li>
52       * <li>Item two.</li>
53       * </ul>}
54       */
55      private void validInlineJavadocList() // ok
56      {
57      }
58  
59      /**
60       * {@summary first does have period.
61       * Use of html tags:
62       * {@code makes tree parse properly}
63       * <p>
64       * This is a paragraph.
65       * </p>}
66       */
67      private void validInlineJavadocTwo() // ok
68      {
69      }
70  
71      /**
72       * {@summary first sentence is normally the summary.
73       * Use of html tags:
74       * <h1> This is heading.</h1>
75       * <p> This is a paragraph.</p>}
76       */
77      private void validInlineJavadocWithParagraph() // ok
78      {
79      }
80  
81      /**
82       * {@summary first sentence is normally the summary.
83       * Use of html tags:
84       * <ul>
85       * <a href="NOEHRE">Item one.</a>
86       * <a href="SOMEWEHRE">Item two.</a>
87       * </ul>}
88       */
89      private void validInlineJavadoc() // ok
90      {
91      }
92  
93      /**
94       * {@summary first sentence is normally the summary.}
95       *
96       * @param a some parameter.
97       * @return This method returns input back.
98       */
99      public int validInlineJavadocReturn(int a) // ok
100     {
101         return a;
102     }
103 
104     /**
105      * {@summary this is first sentence with period.
106      * But here should also be period.
107      * }
108      */
109     private void voidValidJavadoc() {} // ok
110 
111     // violation below 'First sentence of Javadoc is missing an ending period'
112     /**
113      * Sentence starts as a plain text sentence
114      * {@summary ... but ends in the summary tag.}
115      */
116     public class TestClass {}
117 
118     private static class InputSummaryJavadocInlineParagraphCheck {
119         /**
120          * {@summary foo.}
121          */
122         private static final byte NUL = 0; // ok
123 
124         /**
125          * {@summary Some java@doc.
126          * This method returns.}
127          */
128         private static final byte NUL_2 = 0; // ok
129 
130         /**
131          * {@summary Returns the customer ID.
132          *  This method returns. }
133          */
134         private int getId() {return 666;} // ok
135 
136         /**
137          * {@summary This is valid.
138          * <a href="mailto:vlad@htmlbook.ru"/>.}
139          */
140         private void foo2() {} // ok
141 
142         /**
143          * {@summary As of JDK 1.1,
144          * replaced by {@link #setBounds(int,int,int,int)}. This method returns.}
145          */
146         private void foo3() {} // ok
147 
148         /**
149          * {@summary This is description. }
150          * @throws Exception if a problem occurs.
151          */
152         private void foo4() throws Exception {} // ok
153 
154         /**
155          * {@summary An especially short (int... A) bit of Javadoc. This
156          * method returns.}
157          */
158         void foo6() {} // ok
159     }
160 
161     InputSummaryJavadocInlineParagraphCheck iden =
162         new InputSummaryJavadocInlineParagraphCheck() { // ok
163         /**
164          * {@summary JAXB 1.0 only default validation event handler.}
165          */
166         private static final byte NUL = 0; // ok
167 
168         /**
169          * {@summary Returns the current state.
170          * This method returns.}
171          */
172         private boolean emulated(String s) {return false;} // ok
173 
174         /**
175          * {@summary As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}.}
176          */
177         private void foo3() {} // ok
178 
179         /**
180          * {@summary This is valid.}
181          * @throws Exception if a problem occurs.
182          */
183         private void foo4() throws Exception {} // ok
184 
185         /** {@summary An especially short bit of Javadoc.} */
186         void foo5() {} // ok
187 
188         /**
189          * {@summary An especially short bit of Javadoc.}
190          */
191         void foo6() {} // ok
192 
193         /**
194          * {@summary This code is <p>right</p>. }
195          */
196         private void foo7(){} // ok
197 
198         /**
199          * {@summary Some Javadoc. This method returns some javadoc.}
200          */
201         private boolean emulated() {return false;} // ok
202 
203         /**
204          * {@summary Some Javadoc. This method returns some javadoc. Some Javadoc.}
205          */
206         private boolean emulated1() {return false;} // ok
207 
208         /**
209          * {@summary This is valid.}
210          * @return Some Javadoc the customer ID. // ok
211          */
212         private int geId() {return 666;} // ok
213 
214         /**
215          * {@summary This is valid.}
216          * @return Sentence one. Sentence two. // ok
217          */
218         private String twoSentences() {return "Sentence one. Sentence two.";} // ok
219 
220         /** {@summary Stop instances being created.} **/ // ok
221         private String twoSentences1() {return "Sentence one. Sentence two.";} // ok
222     }; // ok
223 }