View Javadoc
1   /*
2   AnnotationLocation
3   allowSamelineMultipleAnnotations = (default)false
4   allowSamelineSingleParameterlessAnnotation = (default)true
5   allowSamelineParameterizedAnnotation = (default)false
6   tokens = INTERFACE_DEF, METHOD_DEF
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.annotation.annotationlocation;
12  
13  import java.lang.annotation.ElementType;
14  import java.lang.annotation.Repeatable;
15  import java.lang.annotation.Target;
16  
17  @InterfaceAnnotation(value = "foo")
18    @InterfaceAnnotation // violation '.* incorrect .* level 2, .* should be 0.'
19  // violation below 'Annotation 'InterfaceAnnotation' should be alone on line.'
20  @InterfaceAnnotation("bar") interface InputAnnotationLocationInterface {
21  
22      @InterfaceAnnotation(value = "foo")
23        @InterfaceAnnotation // violation '.* incorrect .* level 6, .* should be 4.'
24      @InterfaceAnnotation("bar") void method( // violation '.* should be alone on line.'
25          int param1,
26          @InterfaceAnnotation(value = "foo")
27            @InterfaceAnnotation
28          @InterfaceAnnotation("bar") int param2,
29          int param3);
30  
31  }
32  
33  @Repeatable(InterfaceAnnotations.class)
34  @Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE})
35  @interface InterfaceAnnotation  {
36  
37      String value() default "";
38  
39  }
40  
41  @Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE})
42  @interface InterfaceAnnotations {
43  
44      InterfaceAnnotation[] value();
45  
46  }