Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
liniminil opened this issue Oct 16, 2019 · 1 comment · Fixed by #227
Closed

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

liniminil opened this issue Oct 16, 2019 · 1 comment · Fixed by #227

Comments

@liniminil
Copy link

liniminil commented Oct 16, 2019

readMethod.addStatement("$T $N = $T.$L", builderField.get().type, builderField.get(),

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

@liniminil liniminil changed the title Build failed when generating the read method for a generic class Build failed in the generated read method for a generic class Oct 16, 2019
@bryanstern
Copy link
Collaborator

Thanks for the report, should have a fix shortly.

bryanstern added a commit to bryanstern/auto-value-gson that referenced this issue Oct 16, 2019
bryanstern added a commit to bryanstern/auto-value-gson that referenced this issue Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants