1   package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity;
2   
3   import java.lang.annotation.ElementType;
4   import java.lang.annotation.Target;
5   
6   import com.puppycrawl.tools.checkstyle.api.TokenTypes;
7   
8   /* This input file is intended to be used on strict configuration: max=0 */
9   public class InputClassFanOutComplexityAnnotations { // violation
10  
11      private int tokenType = TokenTypes.EXPR;
12  
13      public void foo1(@TypeAnnotation char a) {}
14  
15      public void foo2(final char @TypeAnnotation [] a) {}
16  
17      @MethodAnnotation
18      public void foo3() {}
19  
20      @Override
21      public String toString() {
22          return super.toString();
23      }
24  
25      @MyAnnotation // violation
26      public class InnerClass {
27  
28          @MyAnnotation
29          @MethodAnnotation
30          public void innerClassMethod() {}
31  
32      }
33  
34      public class InnerClass2 { // violation
35  
36          @MethodAnnotation
37          @MyAnnotation
38          public String innerClass2Method(@TypeAnnotation String parameter) {
39              return parameter.trim();
40          }
41  
42      }
43  
44      public class InnerClass3 { // violation
45  
46          @TypeAnnotation
47          private final String warningsType = "boxing";
48  
49          @MyAnnotation
50          @SuppressWarnings(value = warningsType)
51          public String innerClass3Method() {
52              return new Integer(5).toString();
53          }
54  
55      }
56  
57  }
58  
59  class OuterClass { // violation
60  
61      private static final String name = "1";
62  
63      private static final String value = "4";
64  
65      @TwoParametersAnnotation(value = "4", tokenType = 1)
66      public static final String EMPTY_STRING = "";
67  
68      @TwoParametersAnnotation(value = value, tokenType = TokenTypes.ANNOTATION)
69      public static final String TAB = "\t";
70  
71  }
72  
73  @Target(ElementType.TYPE_USE)
74  @interface TypeAnnotation {}
75  
76  @Target(ElementType.METHOD)
77  @interface MethodAnnotation {}
78  
79  @MyAnnotation // violation
80  class MyClass {}
81  
82  @MyAnnotation // violation
83  interface MyInterface {}
84  
85  @interface MyAnnotation {}
86  
87  @interface TwoParametersAnnotation {
88  
89      String value();
90  
91      int tokenType();
92  
93  }