Java Generics: non-static type variable T cannot be referenced from a static context
All member fields of an interface are by default public
, static
and final
.
Since inner interface is static
by default, you can't refer to T
from static fields or methods.
Because T
is actually associated with an instance of a class, if it were associated with a static field or method which is associated with class then it wouldn't make any sense
How about something like this.
public interface A<T> {
interface B<T> extends A<T>{
T foo();
}
}