Fedor Smirnoff wrote:
Name clash: The method setItems(List<OrderItemImp>) of type OrderImp has the same erasure as setItems(List<? extends OrderItem>) of type Order but does not override it
So I am guessing its not possible to set a list in that way? Any ideas on how implement this solution?
While what you are pointing out (or your IDE is pointing out) is indeed an error, it isn't really the first issue to worry about. The issue to worry about is that you failed to implement the Order interface.
The Order interface requires you to implement this...
This is a setItems() method that can take a list of a type that is of OrderItem, or an interface that extends the OrderItem interface. This means that I could implement a class, named Henry, that implements OrderItem. And be able to pass an object (that is a List<Henry>) to the method.
Your implementation...
Won't accept a List of Henrys. This means that you didn't implement the setItems() method as required by the interface.
This is also the indirect cause of the name clash. The compiler is assuming the incorrectly implemented method is simply another method. So, your method, will clash with the correctly implemented method version.
Henry