rharter / auto-value-gson

AutoValue Extension to add Gson De/Serializer support
Apache License 2.0
607 stars 103 forks source link

Build failed in the generated read method for a generic class #226

Closed liniminil closed 5 years ago

liniminil commented 5 years ago

https://github.com/rharter/auto-value-gson/blob/a1aa36ebcd3baf770840fc3c603f6db328e7ca24/auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonExtension.java#L677 The line above will generate an error in the generated code for a generic class. error: <identifier> expected ObjectResponse.Builder builder = ObjectResponse<T>.<T>builder();

    @Override
    @SuppressWarnings("unchecked")
    public ObjectResponse<T> read(JsonReader jsonReader) throws IOException {
      if (jsonReader.peek() == JsonToken.NULL) {
        jsonReader.nextNull();
        return null;
      }
      jsonReader.beginObject();
      ObjectResponse.Builder builder = ObjectResponse<T>.<T>builder(); // Build failed

      ...

version: 1.1.0

bryanstern commented 5 years ago

Thanks for the report, should have a fix shortly.