title: How to get class of generic type parameter in Kotlin
body: <p>I would like get the class property from a generic type <code>T</code>. 
  I've decided to extend to <code>Any</code> but I'm getting an error.
  <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html#extension-properties" rel="noreferrer">https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html#extension-properties</a></p>
  
  <p>I have the following code:</p>
  
  <pre><code>class FirebaseDBRepo&lt;T : Any&gt;(val child:String) {
  
  private var callback: FirebaseDatabaseRepositoryCallback&lt;T&gt;? = null
  private val ref: DatabaseReference
  private val listener = object : ValueEventListener {
      override fun onDataChange(dataSnapshot: DataSnapshot) {
  
          //T::class.java is showing the error cannot use t as reified type parameter use class instead
  
          val gameDS = dataSnapshot.getValue(T::class.java)
          callback!!.onSuccess(gameDS!!)
      }
  
      override fun onCancelled(databaseError: DatabaseError) {
  
      }
  }
  
  init {
      ref = FirebaseDatabase.getInstance().reference.child(child)
  }
  
  
  fun addListener(callback: FirebaseDatabaseRepositoryCallback&lt;T&gt;) {
      this.callback = callback
      ref.addValueEventListener(listener)
  }
  
  fun removeListener() {
      ref.removeEventListener(listener)
  }
  
  }
  </code></pre>