title: Kotlin Generics, correct syntax for type parameters
body: <p>I have the following class, which basically gets a JSON string from AWS, then converts it to an instance of a data class...</p>
  
  <pre><code>class SecretsManager(region: String) {
      private val gson = Gson()
      private val smClient = AWSSecretsManagerClientBuilder.standard().withRegion(region).build()
  
      fun &lt;T&gt; getSecret(id: String): T {
          val req = GetSecretValueRequest().withSecretId(id)
          val json = smClient.getSecretValue(req).getSecretString()
          return gson.fromJson(json, T::class.java)
      }
  }
  
  </code></pre>
  
  <p>To be used like this...</p>
  
  <pre><code>val myInstance = SecretsManager("eu-west-2").getSecret&lt;MyDataClass&gt;("myId")
  </code></pre>
  
  <p>Currently, I get an error - <strong><em>Cannot use 'T' as reified type parameter</em></strong>. I can get around this by marking the function as inline and T as reified , but then I can't access the private attributes from within the function.</p>
  
  <p>What's the best way to do this in Kotlin?</p>