View Javadoc
1   package com.google.checkstyle.test.chapter5naming.rule528typevariablenames;
2   
3   import java.io.Serializable;
4   
5   /** some javadoc. */
6   public class InputInterfaceTypeParameterName<T> {
7     /** some javadoc. */
8     public <TT> void foo() {}
9   
10    <T> void foo(int i) {}
11  }
12  
13  // violation below 'Top-level class OtherClass has to reside in its own source file.'
14  class OtherClass<T extends Serializable & Cloneable> {
15  
16    T getOne() {
17      return null; // comment
18    }
19  
20    <X extends T> /*comment*/ X getTwo(X a) {
21      return null;
22    }
23  
24    <E extends Runnable> E getShadow() {
25      return null;
26    }
27  
28    static class Junk<E> {
29      <T extends E> void getMoreFoo() {}
30    }
31  }
32  
33  // violation below 'Top-level class MoreOtherClass has to reside in its own source file.'
34  class MoreOtherClass<T extends Cloneable> {
35  
36    <E extends T> void getMore() {
37      new Other() {
38        <T> void getMoreFoo() {}
39      };
40  
41      //        Other o = new Other() {
42      //            <EE> void getMoreFoo() {
43      //            }
44      //        };
45    }
46  }
47  
48  // violation below 'Top-level class Boo has to reside in its own source file.'
49  interface Boo<Input> { // violation 'Interface type name 'Input' must match pattern'
50    Input boo();
51  }
52  
53  // violation below 'Top-level class FooInterface has to reside in its own source file.'
54  interface FooInterface<T> {
55    T foo();
56  }
57  
58  // violation below 'Top-level class FooInterface2 has to reside in its own source file.'
59  interface FooInterface2 {
60    Input foo();
61  }
62  
63  // violation below 'Top-level class FooInterface3 has to reside in its own source file.'
64  interface FooInterface3<T2> {
65    Input foo();
66  }
67  
68  // violation below 'Top-level class FooInterface4 has to reside in its own source file.'
69  interface FooInterface4<E> {
70    Input foo();
71  }
72  
73  // violation below 'Top-level class FooInterface5 has to reside in its own source file.'
74  interface FooInterface5<X> {
75    Input foo();
76  }
77  
78  // violation below 'Top-level class FooInterface6 has to reside in its own source file.'
79  interface FooInterface6<RequestT> {
80    Input foo();
81  }
82  
83  interface FooInterface7<Request> {
84    // 2 violations above:
85    //  'Top-level class FooInterface7 has to reside in its own source file.'
86    //  'Interface type name 'Request' must match pattern'
87    Input foo();
88  }
89  
90  interface FooInterface8<TRequest> {
91    // 2 violations above:
92    //  'Top-level class FooInterface8 has to reside in its own source file.'
93    //  'Interface type name 'TRequest' must match pattern'
94    Input foo();
95  }
96  
97  // violation below 'Top-level class Input has to reside in its own source file.'
98  class Input {}