I'm not sure where you're seeing any class nested within C
. That section actually says
It is a compile-time error to refer to a type parameter of a generic
class C anywhere in:
- the declaration of a static member of C (§8.3.1.1, §8.4.3.2, §8.5.1), or
- the declaration of a static member of any type declaration nested within C, or
- a static initializer of C (§8.7), or
- a static initializer of any class declaration nested within C.
Here's an example to demonstrate what each bullet is disallowing:
public class Foo<T> {
private static T t; // first bullet makes this a compiler error
static {
T t; // third bullet makes this a compiler error
}
private static class Bar {
private static T t; // second bullet makes this a compiler error
static {
T t; // fourth bullet makes this a compiler error
}
}
private class Baz {
private static T t; // second bullet again
// you can't have a static initializer
// in a non-static nested class
}
}