I don't think it is something that was explicitly allowed, but simply that it wasn't disallowed.
JLS 8.4.4 Generic Methods doesn't specify any disallowed use of a type variables.
JLS 8.1.2 Generic Classes and Type Parameters lists where T
cannot be used:
It is a compile-time error to refer to a type parameter of a generic class C in any of the following:
- the declaration of a
static
member of C (§8.3.1.1, §8.4.3.2, §8.5.1).
- the declaration of a
static
member of any type declaration nested within C.
- a static initializer of C (§8.7), or
- a static initializer of any class declaration nested within C.
Basically, a type variable is allowed anywhere a type is allowed, unless otherwise stated, and they didn't list static
method call.
Deliberate or oversight? Who knows, but probably deliberate. Since it is allowed to call static methods on an instance variable, why not allow this too. Just because it's allowed, doesn't mean you should ever do it.
As JLS 4.4 Type Variables says it (emphasis mine):
A type variable is an unqualified identifier used as a type in class, interface, method, and constructor bodies.