error in overriding generic collections in Java

前端 未结 5 1838
隐瞒了意图╮
隐瞒了意图╮ 2021-01-28 19:29

When I try to override a method that takes a List, I get the following compile error.

Multiple markers at this

5条回答
  •  感情败类
    2021-01-28 19:53

    The error message is pretty clear: it has the same erasure, but the types don't match, so it's not considered an override. A List is not a List; it can't treat it as either an override (which would require the types to match exactly) nor an overload (which would require the erasures to be different).

提交回复
热议问题