title: Java Generics, the type gets lost
body: <p>The following example, although seemingly correct, won't compile (Eclipse Neon 3, Java 1.8):</p>
  
  <pre><code>class Test {    
  
      public static class SomeForm&lt;IF extends SomeForm&lt;IF&gt;&gt; {
  
      }
  
      public static class BaseFF&lt;IF extends SomeForm&lt;IF&gt;&gt; {
  
      }
  
      public static class AuxFF&lt;IF extends SomeForm&lt;IF&gt;&gt;
              extends BaseFF&lt;IF&gt; {
  
      }
  
      public interface Interface&lt;IF extends SomeForm&lt;IF&gt;, FF extends BaseFF&lt;IF&gt;&gt; {
          FF getFF1();        
      }
  
      public static class ZBaseUnit&lt;IF extends SomeForm&lt;IF&gt;, FF extends BaseFF&lt;IF&gt;&gt;
              implements Interface&lt;IF, FF&gt; {
  
          @Override
          public FF getFF1() {
              return null;
          }
  
      }
  
      public static class ZMyUnit&lt;IF extends SomeForm&lt;IF&gt;, FF extends AuxFF&lt;IF&gt;&gt;
              extends ZBaseUnit&lt;IF, FF&gt; {
  
      }
  
      public static class ZMyCheck&lt;IF extends SomeForm&lt;IF&gt;, U extends ZMyUnit&lt;IF, ?&gt;&gt; {
          U unit;
  
          void f() {
              BaseFF&lt;IF&gt; ff1 = unit.getFF1();
          }
  
      }
  
  }
  </code></pre>
  
  <p>Eclipse says (on the line inside f() method):</p>
  
  <p>"Type mismatch: cannot convert from capture#2-of ? to Test.BaseFF".</p>
  
  <p>However, if I remove the method getFF1 from the interface Interface (and the @Override annotation in the class ZBaseUnit), it compiles. Is there some logic behind this? Intuitively, it seems that FF passed to Interface is the same as FF passed to ZBaseUnit, so there should be no difference...</p>
  
  <p>Also, there is no error if I add the method in ZMyUnit:</p>
  
  <pre><code>void f() {
      BaseFF&lt;IF&gt; ff1 = getFF1();
  }
  </code></pre>
  
  <p>Any help would be appreciated!</p>