1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package com.puppycrawl.tools.checkstyle.checks.metrics.classfanoutcomplexity;
22
23 import java.lang.annotation.ElementType;
24 import java.lang.annotation.Target;
25
26 import java.util.Calendar;
27
28
29 public class InputClassFanOutComplexityAnnotations {
30
31 private int dayOfWeek = Calendar.MONDAY;
32
33 public void foo1(@TypeAnnotation char a) {}
34
35 public void foo2(final char @TypeAnnotation [] a) {}
36
37 @MethodAnnotation
38 public void foo3() {}
39
40 @Override
41 public String toString() {
42 return super.toString();
43 }
44
45 @MyAnnotation
46 public class InnerClass {
47
48 @MyAnnotation
49 @MethodAnnotation
50 public void innerClassMethod() {}
51
52 }
53
54 public class InnerClass2 {
55
56 @MethodAnnotation
57 @MyAnnotation
58 public String innerClass2Method(@TypeAnnotation String parameter) {
59 return parameter.trim();
60 }
61
62 }
63
64 public class InnerClass3 {
65
66 @TypeAnnotation
67 private final String warningsType = "boxing";
68
69 @MyAnnotation
70 @SuppressWarnings(value = warningsType)
71 public String innerClass3Method() {
72 return new Integer(5).toString();
73 }
74
75 }
76
77 }
78
79 class OuterClass {
80
81 private static final String name = "1";
82
83 private static final String value = "4";
84
85 @TwoParametersAnnotation(value = "4", dayOfWeek = 1)
86 public static final String EMPTY_STRING = "";
87
88 @TwoParametersAnnotation(value = value, dayOfWeek = Calendar.TUESDAY)
89 public static final String TAB = "\t";
90
91 }
92
93 @Target(ElementType.TYPE_USE)
94 @interface TypeAnnotation {}
95
96 @Target(ElementType.METHOD)
97 @interface MethodAnnotation {}
98
99 @MyAnnotation
100 class MyClass {}
101
102 @MyAnnotation
103 interface MyInterface {}
104
105 @interface MyAnnotation {}
106
107 @interface TwoParametersAnnotation {
108
109 String value();
110
111 int dayOfWeek();
112
113 }