title: Java Generics: Warning needs a unchecked cast to conform to <InterfaceName>
body: <p>I have an interface </p>
  
  <pre><code>interface x {
      A getValue();
  }
  </code></pre>
  
  <p>and the implementation </p>
  
  <pre><code>class y implements x {
      public B getValue() { return new B();}
  }
  </code></pre>
  
  <p>B is a subclass of A. This works because of covariant overriding, I guess.</p>
  
  <p>But if I rewrite the interface as  </p>
  
  <pre><code>interface x{
      &lt;T extends A&gt; T getValue();
  }
  </code></pre>
  
  <p>I get a warning in the implementation that </p>
  
  <blockquote>
    <p>Warning needs a unchecked cast to
    conform to A.getValue()</p>
  </blockquote>
  
  <p>What is the difference between 2 versions of the interface? I was thinking they are the same.</p>