View Javadoc
1   /*
2   JavadocMethod
3   allowedAnnotations = (default)Override
4   validateThrows = true
5   accessModifiers = (default)public, protected, package, private
6   allowMissingParamTags = (default)false
7   allowMissingReturnTag = (default)false
8   tokens = (default)METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF
9   
10  
11  */
12  
13  package com.puppycrawl.tools.checkstyle.checks.javadoc.javadocmethod;
14  
15  public class InputJavadocMethodGenerics <E extends java.lang.Exception,
16                             RE extends RuntimeException & java.io.Serializable>
17  {
18      /**
19       * @throws E in some cases
20       * @throws RE in some cases
21       */
22      public void method1() throws E
23      {
24      }
25  
26      /**
27       * RuntimeException is not declared.
28       */
29      public void method2() throws RE // violation 'Expected @throws tag for 'RE'.'
30      {
31      }
32  
33      /**
34       * @throws E in some cases
35       * @throws RE in other cases
36       */
37      public void method3() throws E, RE // ok
38      {
39      }
40  
41      /**
42       * @throws RE in some cases
43       * @throws NPE in some other cases
44       */
45      // violation below '.* @param .* '<NPE>'.'
46      public <NPE extends NullPointerException> void method4() throws NPE, RE
47      {
48      }
49  
50      public class InnerClass <RuntimeException extends ClassCastException>
51      {
52          /**
53           * @throws E in some case
54           * @throws RE in some other cases
55           */
56          // violation below 'Expected @throws tag for 'RuntimeException'.'
57          public void method1() throws RuntimeException, RE,
58              java.lang.RuntimeException // violation '.* @throws .* 'java.lang.RuntimeException'.'
59          {
60          }
61      }
62  
63      /**
64       * @param <T> some parameter
65       * @param <E2> some exception parameter
66       */
67      public interface InnerInterface<T, E2 extends Throwable> { // ok
68          /**
69           * Some javadoc.
70           * @param t a parameter
71           * @throws E2 in some case.
72           * @return some string
73           */
74          public abstract String doStuff(T t) throws E2; // ok
75      }
76  
77      /**
78       * @param <P> some parameter
79       */
80      public interface InvalidParameterInJavadoc<T> {} // ok
81  }
82