Please take a look at the code snippet below:
interface IFoo<E>{
void doFoo(E env);
}
class A<E>{
public void doA(E env){}
}
public class Foo<E> implements IFoo<E>{
public A<E> a;
@Override
public void doFoo(E env) {
a.doA(env);
}
private class FooInner<E> implements IFoo<E>{
@Override
public void doFoo(E env) {
a.doA(env);
}
}
}
Eclipse complains about an inner private class a.doA(env)with the following message.
The method doA(E) in the type A<E> is not applicable for the arguments (E)
This does not seem to be an accessibility problem, since a non-static inner class has access to all the instance variables of the outter class. Looks like I misplaced my generics somewhere. Can someone explain to me what I'm doing wrong here?
source
share