title: Java generics type erasure
body: <p>I'd like to ask about java type erasure rules.</p>
  
  <p>If we have classes:</p>
  
  <pre><code>public class Shape{}
  public class Circle extends Shape{}
  
  
  public class Base&lt;T extends Shape&gt;{
      T x;
      public void setX(T t){}
  }
  
  public class MainClass(){
      public static void main(String... _arg){
           Base&lt;? extends Shape&gt; bs = new Base&lt;Circle&gt;(); 
           bs.setX(new Circle()); // &lt;- compilation problem
      }
  }
  </code></pre>
  
  <p>Can you please explain me why calling setX() method causes compilation problem?</p>