title: Java: Implement Setter Method With Subclass of Parameter Type?
body: <p>I have two Interface here:</p>
  
  <pre><code>public interface Configuration {
  
  }
  
  public abstract interface Configurable {
  
      public Configurable setConfig(Configuration config);
  
  }
  </code></pre>
  
  <p>And when one of my implementation tries to override the <code>setConfig()</code>method, the compiler will complain that is not overriding a super class method.</p>
  
  <pre><code>// This is not correct.
  @Override
  public SubConfigurable setConfig(SubConfiguration config) {
      this.config = config;
      return this;
  }
  </code></pre>
  
  <p>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?</p>
  
  <p>Thanks in advance. </p>