title: How to cast generic type after isAssignableFrom check in Kotlin?
body: <p>See the example:</p>
  <pre><code>
  class MyTypeAdapter&lt;T : Throwable&gt;
      (private val gson: Gson, private val skipPast: TypeAdapterFactory) : TypeAdapter&lt;T&gt;() {
     // :Throwable is needed to access the stackTrace field
  }
  
  private class ThrowableTypeAdapterFactory : TypeAdapterFactory {
      override fun &lt;T&gt; create(gson: Gson, typeToken: TypeToken&lt;T&gt;): TypeAdapter&lt;T&gt;? {
          if (Throwable::class.java.isAssignableFrom(typeToken.rawType)) {
              return MyTypeAdapter&lt;T&gt;(gson, this) // compile error: Type argument is not within its bound
          }
          return null
      }
  }
  </code></pre>
  <p>So in Java we have raw use parameterized class but Kotlin doesn't allow it anymore.
  I tried to find something from <a href="https://kotlinlang.org/docs/reference/generics.html" rel="nofollow noreferrer">https://kotlinlang.org/docs/reference/generics.html</a>
  but couldn't get a clue. Please advice.</p>