title: Moshi Unable to create converter for class with generic
body: <p>Some of my server response for success are: </p>
  
  <blockquote>
    <p>{
        "error": null,
        "data": null
    }  </p>
  </blockquote>
  
  <p>My model is: </p>
  
  <pre><code>public class BaseResponse&lt;E &gt; {
  
      @Json(name = "error")
      public ErrorModel error;
  
      @Json(name = "data")
      public E data;
  }
  </code></pre>
  
  <p>If my endpoint is </p>
  
  <pre><code>@POST("user")
  Call&lt;BaseResponse&lt;String&gt;&gt; createUser(@Body Credentials credentials);  
  </code></pre>
  
  <p>This works, but the type String is useless as data will always be null. But if i make it:</p>
  
  <pre><code>@POST("user")
  Call&lt;BaseResponse&gt; createUser(@Body Credentials credentials);  
  </code></pre>
  
  <p>I got crash at </p>
  
  <pre><code>Call&lt;BaseResponse&gt; call = apiService.createUser(creds);
  </code></pre>
  
  <p>full log:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Unable to create converter for 
      class common.model.responses.BaseResponse for method MyEndpoints.createUser
    ...
  Caused by: java.lang.IllegalArgumentException: Expected a Class, ParameterizedType, 
     or GenericArrayType, but &lt;null&gt; is of type null
    at com.squareup.moshi.Types.getRawType(Types.java:167)
    at com.squareup.moshi.ClassJsonAdapter$1.createFieldBindings(ClassJsonAdapter.java:83)
    at com.squareup.moshi.ClassJsonAdapter$1.create(ClassJsonAdapter.java:75)
    at com.squareup.moshi.Moshi.adapter(Moshi.java:100)
    at com.squareup.moshi.ClassJsonAdapter$1.createFieldBindings(ClassJsonAdapter.java:91)
    at com.squareup.moshi.ClassJsonAdapter$1.create(ClassJsonAdapter.java:75)
    at com.squareup.moshi.Moshi.adapter(Moshi.java:100)
    at retrofit2.converter.moshi.MoshiConverterFactory.responseBodyConverter(MoshiConverterFactory.java:91)
    at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:330)
    at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:313)
    at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:736)
   ...
  </code></pre>