I have superclass Foo. And a class Bar extending it.
public class Bar extends Foo
Function in Foo:
protected void saveAll(Collection<?> many)
Function in Bar:
public void saveAll(Collection<MyClass> stuff) {
super.saveAll(stuff);
}
Getting error :
Name clash: The method saveAll(Collection<MyClass>) of type Bar has the same erasure as saveAll(Collection<?>) of type Foo but does not override it.
What am I doing wrong?
You are overriding the
saveAllmethod with an incompatible type. Perhaps you want to do something like:Function in
Foo<E>and function in Bar: