View Javadoc
1   /*
2   AnnotationLocation
3   allowSamelineMultipleAnnotations = (default)false
4   allowSamelineSingleParameterlessAnnotation = (default)true
5   allowSamelineParameterizedAnnotation = (default)false
6   tokens = (default)CLASS_DEF, INTERFACE_DEF, PACKAGE_DEF, ENUM_CONSTANT_DEF, \
7            ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF, RECORD_DEF, COMPACT_CTOR_DEF
8   
9   
10  */
11  
12  package com.puppycrawl.tools.checkstyle.checks.annotation.annotationlocation;
13  
14  /* Config: default */
15  
16  
17  @MyAnnotation6
18  @MyAnnotation5
19  class InputAnnotationLocationCorrect
20  {
21  
22      @MyAnnotation6
23      @MyAnnotation5
24      public int a;
25  
26      @MyAnnotation5
27      public int b;
28  
29      @MyAnnotation6
30      @MyAnnotation5
31      public int c;
32  
33      @MyAnnotation5
34      public int d;
35  
36      @MyAnnotation6
37      @MyAnnotation5
38      public InputAnnotationLocationCorrect()
39      {
40          //comment
41      }
42      @MyAnnotation5
43      @MyAnnotation6
44      void foo1() {}
45  
46      @MyAnnotation5
47      @MyAnnotation6
48      void foo2() {}
49  
50      @MyAnnotation5
51      @MyAnnotation6
52      @MyAnnotation3
53      @MyAnnotation4
54      class InnerClass
55      {
56          @MyAnnotation6
57          @MyAnnotation5
58          public int a;
59  
60          @MyAnnotation5
61          public int b;
62  
63          @MyAnnotation6
64          @MyAnnotation5
65          public int c;
66  
67          @MyAnnotation5
68          public int d;
69  
70          @MyAnnotation6
71          public InnerClass()
72          {
73              // comment
74          }
75          @MyAnnotation5
76          @MyAnnotation6 void foo1(int a) {}
77  
78          @MyAnnotation5
79          @MyAnnotation6
80          void foo2() {}
81      }
82  
83      @MyAnnotation5
84      @MyAnnotation6
85      InnerClass anon = new InnerClass()
86      {
87          @MyAnnotation6
88          @MyAnnotation5
89          public int a;
90  
91          @MyAnnotation5 public int b;
92  
93          @MyAnnotation6
94          @MyAnnotation5
95          public int c;
96  
97          @MyAnnotation5
98          public int d;
99  
100         @MyAnnotation5
101         @MyAnnotation6 void foo1() {}
102 
103         @MyAnnotation5
104         @MyAnnotation6
105         void foo2() {}
106     };
107 
108 }
109 
110 @MyAnnotation5
111 @MyAnnotation6
112 class _Foo {}
113 
114 @interface MyAnnotation5 {}
115 
116 @interface MyAnnotation6 {}