I have two Interface here:
public interface Configuration {
}
public abstract interface Configurable {
public Configurable setConfig(Configuration config);
}
And when one of my implementation tries to override the setConfig()method, the compiler will complain that is not overriding a super class method.
// This is not correct.
@Override
public SubConfigurable setConfig(SubConfiguration config) {
this.config = config;
return this;
}
I understand that I could always pass in a Configuration object and cast down to its real type but I am wondering if there is better way to target this. Or maybe I am just in a wrong design approach?
Thanks in advance.
SubConfigurationby chance?