View Javadoc
1   /*
2   JavadocMethod
3   validateThrows = true
4   
5   */
6   
7   package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocmethod;
8   
9   public class InputJavadocMethodAboveComments {
10  
11      /**
12       * A Javadoc comment.
13       * @return 0
14       */
15      //@ A JML Annotation
16      public int foo() throws Exception { // violation, 'Expected @throws tag for 'Exception''
17          return 0;
18      }
19  
20      /**
21       * A Javadoc comment.
22       * @return 0
23       */
24      /*@ A JML Annotation */
25      public int foo2() throws Exception { // violation, 'Expected @throws tag for 'Exception''
26          return 0;
27      }
28  
29      /**
30       * A dangling Javadoc comment.
31       * @throws Exception exception
32       * @return 0
33       */
34      /**
35       * A Javadoc comment.
36       * @throws Exception exception
37       * @return 0
38       */
39      public int foo3() throws Exception {
40          return 0;
41      }
42  
43      /**
44       * A dangling Javadoc comment.
45       * @throws Exception exception
46       * @return 0
47       */
48      /**
49       * A Javadoc comment.
50       * @return 0
51       */
52      public int foo4() throws Exception {  // violation, 'Expected @throws tag for 'Exception''
53          return 0;
54      }
55  
56      /**
57       * A Javadoc comment.
58       * @return 0
59       */
60      @SuppressWarnings("unchecked")
61      /* generic type warnings are suppressed for this method
62      because of reason xyz */
63      public int method() throws Exception { // violation, 'Expected @throws tag for 'Exception''
64          return 0;
65      }
66  
67      /**
68       * A Javadoc comment.
69       * @return 0
70       */
71      /* generic type warnings are suppressed for this method
72      because of reason xyz */
73      @SuppressWarnings("unchecked")
74      public int method2() throws Exception {  // violation,'Expected @throws tag for 'Exception''
75          return 0;
76      }
77  
78      /**
79       * A Javadoc comment.
80       * @return 0
81       */
82      // generic type warnings are suppressed for this method because of reason xyz
83      @SuppressWarnings("unchecked")
84      public int method3() throws Exception { // violation, 'Expected @throws tag for 'Exception''
85          return 0;
86      }
87  
88      /**
89       * A Javadoc comment.
90       * @return 0
91       */
92      @SuppressWarnings("unchecked")
93      // generic type warnings are suppressed for this method because of reason xyz */
94      public int method4() throws Exception { // violation, 'Expected @throws tag for 'Exception''
95          return 0;
96      }
97  
98      /*@ A JML Annotation */
99      public int foo5() {
100         return 0;
101     }
102 
103     /**
104      * A Javadoc comment.
105      * @return 0
106      */
107     /*@ A JML Annotation */ public int foo6() { return 0; }
108 
109 
110     public void foo7() throws Exception { }
111 
112     /**
113      * A Javadoc comment.
114      * @return 0
115      */
116     public int foo8() { return 0; } /* @ A JML Annotation */
117 
118     public void foo9() throws Exception { }
119 }