title: How to conform Java upper bounded wildcard type parameter to Kotlin?
body: <p>Given</p>
  <pre><code>public interface StubTransformer {
      AbstractStub&lt;?&gt; transform(String name, AbstractStub&lt;?&gt; stub);
  }
  </code></pre>
  <p>and</p>
  <pre><code>public static &lt;T extends AbstractStub&lt;T&gt;&gt; T attachHeaders(T stub, Metadata extraHeaders) {...}
  </code></pre>
  <p>this Kotlin class fails to compile.</p>
  <pre><code>class MetadataInjectingStubTransformer: StubTransformer {
      override fun transform(name: String, stub: AbstractStub&lt;*&gt;): AbstractStub&lt;*&gt; {
          val header = Metadata()
          return MetadataUtils.attachHeaders(stub, header)
      }
  }
  </code></pre>
  <p>Error</p>
  <pre><code>Type parameter bound for T in 
  
  fun &lt;T : AbstractStub&lt;T!&gt;!&gt; attachHeaders(stub: T!, extraHeaders: Metadata!): T!
  is not satisfied: inferred type AbstractStub&lt;*&gt;! is not a subtype of AbstractStub&lt;AbstractStub&lt;*&gt;!&gt;!
  </code></pre>
  <p>but the Java version can be forced to compile.</p>
  <pre><code>public class MetadataInjectingStubTransformer implements StubTransformer {
      @Override
      @SuppressWarnings(&quot;unchecked&quot;)
      public AbstractStub&lt;?&gt; transform(String name, AbstractStub stub) {
          Metadata header = new Metadata();    
          return MetadataUtils.attachHeaders(stub, header);
      }
  }
  </code></pre>
  <p>How do we make the Kotlin code compile?</p>