View Javadoc
1   /*
2   DesignForExtension
3   ignoredAnnotations = Override, Deprecated, MyAnnotation
4   requiredJavadocPhrase = (default).*
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.design.designforextension;
10  
11  public class InputDesignForExtensionIgnoredAnnotations {
12  
13      @Override
14      public int hashCode() {
15          return super.hashCode();
16      }
17  
18      /**
19       * Javadoc.
20       * @param obj object.
21       * @return boolean.
22       */
23      @Override
24      public boolean equals(Object obj) {
25          return super.equals(obj);
26      }
27  
28      @Deprecated
29      public void testFoo() throws Exception {
30          final int a = 5;
31          final int b = 6;
32      }
33  
34      @Deprecated
35      public String toString() {
36          return super.toString();
37      }
38  
39      public int foo1() {return  1;} // violation
40  
41      /**
42       *
43       * @return
44       */
45      public int foo2() {return 2;}
46  
47      public void foo3() {}
48  
49      public class C extends B {
50          @Deprecated
51          @Override
52          public void testFoo() {
53              super.testFoo();
54          }
55      }
56  
57      public class B {
58          /** Test foo*/
59          public void testFoo() {
60              final int a = 6;
61          }
62      }
63  
64      // Deprecated
65      @Deprecated
66      public void foo4() {return;}
67  
68      /*
69       * Deprecated
70       */
71      @Deprecated
72      public void foo5() {return;}
73  
74      @java.lang.Deprecated
75      public void foo6() {return;}
76  
77      // Single line comment
78      @Deprecated
79      public void foo7() {
80          return;
81      }
82  
83      // Single line comments
84      // organized in a block
85      @Deprecated
86      public void foo8() {
87          return;
88      }
89  
90      /** Javadoc comment */
91      @Deprecated
92      public void foo9() {
93          return;
94      }
95  
96      /* Block comment */
97      @Deprecated
98      public void foo10() {
99          return;
100     }
101 
102     @Deprecated
103     /** */
104     public int foo11() {
105         return 1;
106     }
107 
108     @Deprecated
109     /* */
110     public int foo12() {
111         return 1;
112     }
113 
114     @Deprecated
115     /* */
116     public void foo13() { }
117 
118     @Deprecated
119     /** */
120     public void foo14() { }
121 
122     @Deprecated
123     /** */
124     public void foo15() { /** */ }
125 
126     @Deprecated
127     // comment
128     public void foo16() { }
129 
130     @Deprecated
131     @InputDesignForExtensionsLocalAnnotations.ClassRule
132     public void foo17() { return; }
133 
134     @Deprecated
135     @InputDesignForExtensionsLocalAnnotations.ClassRule
136     /** */
137     public void foo18() { return; }
138 
139     @Deprecated
140     /** */
141     @InputDesignForExtensionsLocalAnnotations.ClassRule
142     public void foo19() { return; }
143 
144     /** */
145     @Deprecated
146     @InputDesignForExtensionsLocalAnnotations.ClassRule
147     public void foo20() { return; }
148 
149     @InputDesignForExtensionsLocalAnnotations.ClassRule // violation
150     public void foo21() { return; }
151 
152     private int age;
153 
154     @Inject // violation
155     public void setAge(int age) {
156         this.age = age;
157     }
158 
159     public @interface Inject { }
160 
161     public @MyAnnotation void foo22() {
162         foo1();
163     }
164 
165     @MyAnnotation public void foo23() {
166         foo1();
167     }
168 
169     public void foo24(@MyAnnotation int a) { // violation
170         foo1();
171     }
172 
173     /**
174      * @deprecated
175      */
176     <T> T dontUse4() { // violation 'method 'dontUse4' does not have javadoc'
177         return null;
178     }
179 
180     public @interface MyAnnotation { }
181 }
182 class InputDesignForExtensionsLocalAnnotations {
183     @interface Rule {}
184 
185     @interface ClassRule {}
186 }