I want to implement an interface which has inner interface. I have problem with overriding setter method. Here is draft of my problem:
Interfaces hierarchy:
public interface A {
public interface B {}
public void setBs(List<B> list);
}
Implementation:
public class AImpl implements A {
private List<BImpl> listOfBs;
public static class BImpl implements B {}
@Override
public void setBs(... list) { listOfBs = list }
}
What should be the type of setBs(... list) method's parameter? List<? extends B> doesn't override superclass's method.
As mentioned by fantarama, signature should be public void setBs(List<B> list).
If you're getting the error in your IDE or build framework, make sure your java compiler and target versions are set correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With