1
2
3
4
5
6
7
8
9
10
11
12 package com.puppycrawl.tools.checkstyle.checks.annotation.annotationlocation;
13
14 import java.lang.annotation.ElementType;
15 import java.lang.annotation.Target;
16
17 public class InputAnnotationLocationDeprecatedAndCustom {
18 @Deprecated
19 public class Annotation
20 {
21 @Deprecated
22 public void test(@MyAnnotation String s) {
23 @MyAnnotation
24 Integer i;
25 for (@MyAnnotation char c : s.toCharArray()) {
26 }
27 }
28 }
29
30 public class Test {
31 public void foo1() {
32 try {
33
34 }
35 catch (@MyAnnotation Exception ex) {
36
37 }
38 }
39
40 public void foo2() {
41 for (@MyAnnotation int i = 0; i < 10; i++) {
42
43 }
44 }
45
46 public void foo3() {
47 MathOperation c = (@MyAnnotation int a, @MyAnnotation int b) -> a + b;
48 }
49
50 public void foo4(@MyAnnotation int a, @MyAnnotation int b) {}
51
52 public void foo5(@SuppressWarnings("unchecked") int a) {}
53 }
54
55 interface MathOperation {
56 int operation(int a, int b);
57 }
58
59 @Target(ElementType.TYPE_USE)
60 public @interface MyAnnotation {}
61 }