View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule4854fieldannotations;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   /** Some javadoc. */
7   public class InputFieldAnnotations {
8     /** Some javadoc. */
9     public @interface SomeAnnotation1 {}
10  
11    /** Some javadoc. */
12    public @interface SomeAnnotation2 {}
13  
14    /** Some javadoc. */
15    public @interface SomeAnnotation3 {
16      /** Some javadoc. */
17      int x();
18    }
19  
20    /** testing. */
21    @SomeAnnotation1
22    @SomeAnnotation2
23    String name = "Zops";
24  
25    /** testing. */
26    @SomeAnnotation1 @SomeAnnotation2
27    int age = 19;
28  
29    /** testing. */
30    @SomeAnnotation1
31    @SomeAnnotation2 String favLanguage = "Java";
32  
33    /** testing. */
34    @SomeAnnotation1
35    @SomeAnnotation3(x = 90) String favPet = "Dog";
36  
37    @SomeAnnotation1 @SomeAnnotation2 boolean test = false;
38  
39    @SuppressWarnings("bla") @SomeAnnotation3(x = 0) float pi = 3.14f;
40  
41    @SomeAnnotation1 @SomeAnnotation3(x = 14)
42    /** testing. */ // violation 'Javadoc comment is placed in the wrong location.'
43    List<String> list = new ArrayList<>();
44  
45    @SuppressWarnings("bla")
46    @SomeAnnotation1
47    /** testing. */ // violation 'Javadoc comment is placed in the wrong location.'
48    InputFieldAnnotations obj = new InputFieldAnnotations();
49  
50    /** testing. */
51    @SomeAnnotation1 @SomeAnnotation2
52    // violation above 'Annotation 'SomeAnnotation2' should be alone on line.'
53    void test1() {}
54  
55    @SomeAnnotation1 @SomeAnnotation2 void test2() {}
56    // violation above 'Annotation 'SomeAnnotation2' should be alone on line.'
57  
58    @SomeAnnotation3(x = 78) void test3() {}
59    // violation above 'Annotation 'SomeAnnotation3' should be alone on line.'
60  }