title: Generics in return types of static methods and inheritance
body: <p>Generics in return types of static methods do not seem to get along well with inheritance. Please take a look at the following code:</p>
  
  <pre><code>class ClassInfo&lt;C&gt;  {
    public ClassInfo(Class&lt;C&gt; clazz) {
      this(clazz,null);
    }  
    public ClassInfo(Class&lt;C&gt; clazz, ClassInfo&lt;? super C&gt; superClassInfo) {
    }
  }
  
  class A {
      public static ClassInfo&lt;A&gt; getClassInfo() {
          return new ClassInfo&lt;A&gt;(A.class);
      }
  }
  
  class B extends A {
      // Error: The return type is incompatible with A.getClassInfo()
      public static ClassInfo&lt;B&gt; getClassInfo() { 
          return new ClassInfo&lt;B&gt;(B.class, A.getClassInfo());
      }
  }
  </code></pre>
  
  <p>I tried to circumvent this by changing the return type for A.getClassInfo(), and now the error pops up at another location:</p>
  
  <pre><code>class ClassInfo&lt;C&gt;  {
    public ClassInfo(Class&lt;C&gt; clazz) {
      this(clazz,null);
    }  
    public ClassInfo(Class&lt;C&gt; clazz, ClassInfo&lt;? super C&gt; superClassInfo) {
    }
  }
  
  class A {
      public static ClassInfo&lt;? extends A&gt; getClassInfo() {
          return new ClassInfo&lt;A&gt;(A.class);
      }
  }
  
  class B extends A {
      public static ClassInfo&lt;? extends B&gt; getClassInfo() { 
          // Error: The constructor ClassInfo&lt;B&gt;(Class&lt;B&gt;, ClassInfo&lt;capture#1-of ? extends A&gt;) is undefined
          return new ClassInfo&lt;B&gt;(B.class, A.getClassInfo());
      }
  }
  </code></pre>
  
  <p>What is the reason for this strict checking on static methods? And how can I get along? Changing the method name seems awkward.</p>