I have a class like this:
public abstract class SomeClass<E extends AnotherClass> {
private E someVariable;
public E formatVariable(){
E formatted = someVariable.format(); //format is a method in AnotherClass, which returns AnotherClass
return formatted;
}
}
Eclipse gives me an error, it "cannot convert from AnotherClass to E"
I am confused because in the class decleration I made it so that E is AnotherClass or a subclass of it, or at least that was my understanding of it.
What's going on here, and how can I fix this error?
Eis anAnotherClass, but anAnotherClassis not necessarily anE. The result offormatis anAnotherClass, but it isn't guaranteed to be anE.