title: How to refactor method to avoid wild card return type?
body: <p>The below <code>get</code> method given Sonar issue:</p>
  <blockquote>
  <p>Generic wildcard types should not be used in return types.</p>
  </blockquote>
  <p>I need some expert help to refactor this code to avoid that Sonar issue. I try different ways like <code>Entity&lt;D.Id&gt;</code> but I haven't idea how to combine with <code>Entity&lt;C.Id&gt;</code>.</p>
  <pre><code>public interface Identity {
    //
  }
  
  public interface Entity&lt;I extends Identity&gt; {
    //
  }
  
  public interface D
    extends Entity&lt;D.Id&gt;
  {
  }
  
  public interface C
    extends Entity&lt;C.Id&gt;
  {
  }
  
  
  protected Entity&lt;? extends Identity&gt; get(final String value)
   {
      if (value == 'valuD')
      {
        return new D() //return object;
      }
      else
      {
        return new C() //return object;
      }
    }
  </code></pre>