View Javadoc
1   package com.google.checkstyle.test.chapter5naming.rule528typevariablenames;
2   
3   import java.io.Serializable;
4   
5   class InputMethodTypeParameterName<T> {
6     public <TT> void foo() {}
7   
8     <e_e> void foo(int i) { // violation 'Method type name 'e_e' must match pattern'
9     }
10  }
11  
12  // violation below 'Top-level class Other2 has to reside in its own source file.'
13  class Other2<T extends Serializable & Cloneable> {
14  
15    T getOne() {
16      return null;
17    }
18  
19    <Tfo$o2T extends T> Tfo$o2T getTwo(Tfo$o2T a) {
20      // violation above 'Method type name 'Tfo\$o2T' must match pattern'
21      return null;
22    }
23  
24    <foo_ extends Runnable> T getShadow() {
25      // violation above 'Method type name 'foo_' must match pattern'
26      return null;
27    }
28  
29    static class Junk<E> {
30      <_abc extends E> void getMoreFoo() {
31        // violation above 'Method type name '_abc' must match pattern'
32      }
33    }
34  }
35  
36  // violation below 'Top-level class MoreOther3 has to reside in its own source file.'
37  class MoreOther3<T extends Cloneable> {
38  
39    <E extends T> void getMore() {
40      new Other2() {
41        <T$> void getMoreFoo() { // violation 'Method type name 'T\$' must match pattern'
42        }
43      };
44  
45      Other2 o =
46          new Other2() {
47            <EE> void getMoreFoo() { // violation 'Method type name 'EE' must match pattern'
48            }
49          };
50    }
51  }