forked from checkstyle/checkstyle
/
InputAnnotationLocationIncorrect.java
117 lines (84 loc) · 2.39 KB
/
InputAnnotationLocationIncorrect.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package com.puppycrawl.tools.checkstyle.checks.annotation.annotationlocation;
@MyAnnotation2 @com.puppycrawl.tools.checkstyle.checks.annotation.annotationlocation.MyAnn //warn
(value = "")
class InputAnnotationLocationIncorrect
{
@MyAnnotation2 @MyAnnotation1(value = "")
public int a;
@MyAnnotation1(value = "") public int b; //warn
@MyAnnotation2
@MyAnnotation1 //warn
(value = "")
public int c;
@MyAnnotation1(value = "")
public int d;
@MyAnnotation2
@MyAnnotation1 //warn
(value = "")
public InputAnnotationLocationIncorrect() {}
@MyAnnotation1("foo") @MyAnnotation2 void foo1() {} //warn
@MyAnnotation1(value = "")
@MyAnnotation2 //warn
void foo2() {}
@MyAnnotation1(value = "")
@MyAnnotation2 //warn
@MyAnnotation3 //warn
@MyAnnotation4 //warn
class InnerClass
{
@MyAnnotation2 @MyAnnotation1 //warn
(value = "")
public int a;
@MyAnnotation1(value = "") public int b; //warn
@MyAnnotation2
@MyAnnotation1 //warn
(value = "")
public int c;
@MyAnnotation1(value = "")
public int d;
@MyAnnotation2
@MyAnnotation1(value = "") public InnerClass() //warn
{
// comment
}
@MyAnnotation1(value = "")
@MyAnnotation2 //warn
void foo1() {}
@MyAnnotation1(value = "")
@MyAnnotation2 //warn
void foo2() {}
}
@MyAnnotation1(value = "")
@MyAnnotation2 //warn
InnerClass anon = new InnerClass()
{
@MyAnnotation2 @MyAnnotation1(value = "") public int a;
@MyAnnotation1(value = "") public int b; //warn
@MyAnnotation2
@MyAnnotation1(value = "")
public int c;
@MyAnnotation1(value = "")
public int d;
@MyAnnotation1(value = "")
@MyAnnotation2 void foo1() {} //warn
@MyAnnotation1(value = "")
@MyAnnotation2 //warn
void foo2() {}
@MyAnnotation1(value = "") void foo42() {} //warn
};
}
@MyAnnotation1 //warn
(value = "")
@MyAnnotation2
class Foo {
public void method1(@MyAnnotation3 @MyAnnotation2 Object param1) {
return;
}
}
@interface MyAnnotation1 {
String value();}
@interface MyAnnotation2 {}
@interface MyAnnotation3 {}
@interface MyAnnotation4 {}
@interface MyAnn {
String value();}