title: Type mismatch: inferred type is KClass<GenderStatistics> but Class<TypeVariable(T)!>! was expected
body: <p>I am trying to build <a href="https://quarkus.io/guides/hibernate-orm-panache#query-projection" rel="nofollow noreferrer">Query Projection</a> and I have encountered the following error message:</p>
  <pre><code>Type mismatch: inferred type is KClass&lt;GenderStatistics&gt; but Class&lt;TypeVariable(T)!&gt;! was expected
  </code></pre>
  <p>the code that is causing the problem:</p>
  <pre><code>  fun status(): String {
      val query = accRepo.find(&quot;&quot;&quot;
        select g.abbr as abbr, g.description as description, count(p) as quantity
          from Account a
          inner join a.gender as g
          group by g.abbr, g.description
        &quot;&quot;&quot;.trimIndent())
          .project(GenderStatistics::class)
  </code></pre>
  <p>The method <code>project</code> expects type <code>Class&lt;TypeVariable(T)!&gt;!</code> but I have passed wrong type. How to pass the correct type in Kotlin? In Java, it will be <code>GenderStatistics.class</code></p>
  <p>The <code>GenderStatistics</code> is defined as:</p>
  <pre><code>@RegisterForReflection
  class GenderStatistics(val abbr: String, val description: String, val quantity: Int)
  </code></pre>