title: Gson illegal type variable reference
body: <p>I have a class defined as:</p>
  
  <pre><code>public class Calls&lt;T extends Object&gt;
  </code></pre>
  
  <p>Inside this class there is a method <code>doRequest</code> that creates a <code>TypeToken</code> (from <code>com.google.json.reflect</code>) for a Gson request.</p>
  
  <pre><code>java.lang.reflect.Type type = new TypeToken&lt;HandlerResponse&lt;T&gt;&gt;(){{}}.getType();
  </code></pre>
  
  <p>where <code>HandlerResponse</code> is a simple model class that contains attributes like:</p>
  
  <pre><code>private Map detail;
  
  private transient T data;
  
  private transient int count = 0;
  
  private String status;
  </code></pre>
  
  <p>The exception I get on Android Studio is:</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: PID: 32628
  java.lang.AssertionError: illegal type variable reference
      at libcore.reflect.TypeVariableImpl.resolve(TypeVariableImpl.java:111)
      at libcore.reflect.TypeVariableImpl.getGenericDeclaration(TypeVariableImpl.java:125)
      at libcore.reflect.TypeVariableImpl.hashCode(TypeVariableImpl.java:47)
      at java.util.Arrays.hashCode(Arrays.java:4153)
      at com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl.hashCode($Gson$Types.java:479)
      at com.google.gson.reflect.TypeToken.&lt;init&gt;(TypeToken.java:64)
      at com.company.server.Calls$4.&lt;init&gt;(Calls.java:244)
  </code></pre>
  
  <p>crashes at the instantiation of the TypeToken (I was thinking that probably is losing the T class 'cause of the type erasure of Java).</p>
  
  <p>I create the instance of <code>Calls</code> as:</p>
  
  <pre><code>Calls&lt;com.company.model.beans.Model&gt; calls = new Calls&lt;&gt;(){};
  </code></pre>