I have generic class with generic method
class Foo<T> {
public <E> E execute() {
return null;
}
}
Could someone explain to me why this:
class Bar extends Foo {
public <E> E execute() {
return null;
}
}
produces error
execute() in Bar clashes with execute() in Foo; both methods have the same erasure, yet neither overrides the other
whereas this is ok
class Bar extends Foo<Object> {
public <E> E execute() {
return null;
}
}