interface A<T> {
interface B {
// Results in non-static type variable T cannot
// be referenced from a static context
T foo();
}
}
Is there anyway round this? Why is T seen as static when referenced from A.B?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All member fields of an interface are by default
public,staticandfinal.Since inner interface is
staticby default, you can’t refer toTfrom static fields or methods.Because
Tis 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