title: Java generics, get Class<T> of generic parameter
body: <p>I have an abstract class: </p>
  
  <pre><code>public abstract class RootProcessor&lt;T&gt; {
      Class&lt;T&gt; clazz;
  }
  </code></pre>
  
  <p>I need to fill <code>ClassT clazz;</code> with the children of <code>RootProcessor</code> - every child has its own <code>T</code></p>
  
  <p>I found only one solution, but it needs compiler argument <code>-Xlint:unchecked</code></p>
  
  <pre><code>public RootProcessor(){
      this.clazz = (Class&lt;T&gt;) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
  }
  </code></pre>
  
  <p>Is this the best solution? Can we do the same without <code>-Xlint:unchecked</code> ?</p>