title: Why am I unable to cast bounded Java generics to a superclass with similar types?
body: <p>Consider the following Java Generics layout where I would expect ItemList to have a compatible interface to List:</p>
  
  <pre class="lang-java prettyprint-override"><code>    public interface ItemList&lt;T extends Item&gt; extends List&lt;T&gt; {}
  
      public interface Item {}
  
      public interface List&lt;T&gt; {}
  
      public static class Test&lt;T extends Item&gt; {
  
          public void foo(ItemList&lt;T&gt; fizz) {
              // T extends B
              // fizz is A&lt;T extends B&gt; extends C&lt;T extends B&gt;
              // therefore, is fizz not always compatible with C&lt;B&gt;?
  
              // bar(fizz); error?
              bar((List&lt;Item&gt;) fizz); // allowed, but unchecked cast warning?
          }
  
          private void bar(List&lt;Item&gt; buzz) {}
      }
  </code></pre>
  
  <p>I.e. Why am I unable to pass <code>fizz</code> to the <code>bar</code> method and why am I being warned of an unchecked cast? Is this guaranteed to be a safe cast, or is the warning a legitimate issue?</p>