Java generics name clash , has the same erasure

前端 未结 6 1600
[愿得一人]
[愿得一人] 2020-12-15 03:56

I have superclass Foo. And a class Bar extending it.

public class Bar extends Foo

Function in Foo:

protected void saveAll(C         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-15 04:12

    You are overriding the saveAll method with an incompatible type. Perhaps you want to do something like:

    public class Bar extends Foo
    

    Function in Foo

    protected void saveAll(Collection many)
    

    and function in Bar:

    public void saveAll(Collection stuff) {
       super.saveAll(stuff);
    }
    

提交回复
热议问题