View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.Collections;
6   import java.util.HashMap;
7   import java.util.List;
8   import java.util.Map;
9   import java.util.concurrent.Callable;
10  
11  class InputGenericWhitespace implements Comparable<InputGenericWhitespace>, Serializable {
12    <T> InputGenericWhitespace(List<T> things, int i) {}
13  
14    public <T> InputGenericWhitespace(List<T> things) {}
15  
16    public static <T> Callable<T> callable(Runnable task, T result) {
17      return null;
18    }
19  
20    // 2 violations 3 lines below:
21    //  ''\<' is not preceded with whitespace.'
22    //  ''\>' should followed by whitespace.'
23    public static<T>Callable<T> callable2(Runnable task, T result) {
24      Map<Class<?>, Integer> x = new HashMap<Class<?>, Integer>();
25      for (final Map.Entry<Class<?>, Integer> entry : x.entrySet()) {
26        entry.getValue();
27      }
28      Class<?>[] parameterClasses = new Class<?>[0];
29      return null;
30    }
31  
32    void meth() {
33      List<Integer> x = new ArrayList<Integer>();
34      List<List<Integer>> y = new ArrayList<List<Integer>>();
35      List < Integer > a = new ArrayList < Integer >();
36      // 6 violations above:
37      //  ''\<' is followed by whitespace.'
38      //  ''\<' is preceded with whitespace.'
39      //  ''\>' is preceded with whitespace.'
40      //  ''\<' is followed by whitespace.'
41      //  ''\<' is preceded with whitespace.'
42      //  ''\>' is preceded with whitespace.'
43      List < List < Integer > > b = new ArrayList < List < Integer > >();
44      // 14 violations above:
45      //  ''\<' is followed by whitespace.'
46      //  ''\<' is preceded with whitespace.'
47      //  ''\<' is followed by whitespace.'
48      //  ''\<' is preceded with whitespace.'
49      //  ''\>' is followed by whitespace.'
50      //  ''\>' is preceded with whitespace.'
51      //  ''\>' is preceded with whitespace.'
52      //  ''\<' is followed by whitespace.'
53      //  ''\<' is preceded with whitespace.'
54      //  ''\<' is followed by whitespace.'
55      //  ''\<' is preceded with whitespace.'
56      //  ''\>' is followed by whitespace.'
57      //  ''\>' is preceded with whitespace.'
58      //  ''\>' is preceded with whitespace.'
59    }
60  
61    public int compareTo(InputGenericWhitespace obj) {
62      return 0;
63    }
64  
65    public int getConstructor(Class<?>... parameterTypes) {
66      Collections.<Object>emptySet();
67      Collections. <Object> emptySet();
68      // 2 violations above:
69      //  ''\<' is preceded with whitespace.'
70      //  ''\>' is followed by whitespace.'
71      return 666;
72    }
73  
74    public interface IntEnum {}
75  
76    public static class IntEnumValueType<E extends Enum<E> & IntEnum> {}
77  
78    public static class IntEnumValueType2<E extends Enum<E>& IntEnum> {
79      // 2 violations above:
80      //  ''&' is not preceded with whitespace.'
81      //  ''&' is not preceded with whitespace.'
82    }
83  
84    public static class IntEnumValueType3<E extends Enum<E>  & IntEnum> {
85      // violation above ''\>' is followed by whitespace.'
86    }
87  }