title: Kotlin abstract class with generic param and methods which use type param
body: <p>I'm trying to create an abstract class with generic parameter which will have subclasses which should call methods <strong>without having to specify type parameters</strong>.
  I have this so far:</p>
  
  <pre><code>abstract class AbstractClass&lt;T : Any&gt; @Autowired constructor(protected val delegate: MyService) {
      inline fun &lt;T: Any&gt; myMethod(param: Any): T? {
          return delegate.myMethod(param).`as`(T::class.java)
      }
  }
  </code></pre>
  
  <p>And implementation:</p>
  
  <pre><code>class TesterWork @Autowired constructor(delegate: MyService) : AbstractClass&lt;Tester&gt;(delegate) {
  }
  </code></pre>
  
  <p>Now when calling <code>myMethod</code> I have to specify the type argument:</p>
  
  <pre><code>testerWork.myMethod&lt;Tester&gt;("test")
  </code></pre>
  
  <p>I was wondering would it be possible to infer the type argument automatically?
  Can I somehow rework myMethod? Note that I need to have <code>T::class.java</code> inside the method.</p>