title: How to keep generic type of nested generics with class tokens
body: <p>The standard way in Java to work around type erasure is to pass a class token into the constructor. For example we could define a generic property class like this:</p>
  
  <pre><code>class Prop&lt;T&gt; {
      public Prop(Class&lt;T&gt; type) {
          this.type = type;
      }
      Class&lt;T&gt; type;
      T t;
  }
  
  class IntProp extends Prop&lt;Integer&gt; {
      public IntProp() {
          super(Integer.class);
      }
  }
  </code></pre>
  
  <p>But what if I now want to use another generic type argument, such as a list and also keep its generics type. I would have liked to do this:</p>
  
  <pre><code>class ListProp&lt;J&gt; extends Prop&lt;ArrayList&lt;J&gt;&gt; {
      Class&lt;J&gt; subtype;
      public ListProp(Class&lt;J&gt; type) {
          super(ArrayList&lt;J&gt;.class);
          subtype = type;
      }
  }
  
  class IntListProp extends ListProp&lt;Integer&gt; {
      public IntListProp() {
          super(Integer.class);
      }
  }
  </code></pre>
  
  <p>But of course <code>super(ArrayList&lt;J&gt;.class)</code> does not compile, neither does <code>super(ArrayList.class)</code> . What's the best way to solve this?</p>