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