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

When defining an abstract class with generics, compilation fails. #17

Closed
ErikHellman opened this issue Mar 12, 2016 · 4 comments
Closed

Comments

@ErikHellman
Copy link

Given the class @AutoValue abstract class Foo<T>, compilation fails when I include auto-value-moshi (apt 'com.ryanharter.auto.value:auto-value-moshi:0.2-SNAPSHOT').

@AngusMorton
Copy link
Contributor

AngusMorton commented Apr 18, 2016

Looks like the moshi extension generates the class without generic type parameters.

Given an AutoValue class:

@AutoValue
public abstract class Action<T> {
  public abstract T value();
}

The Moshi extension generates a class with the generic type parameters missing, final class AutoValue_Action extends $AutoValue_Action instead of final class AutoValue_Action<T> extends $AutoValue_Action<T>

@ZacSweers
Copy link
Collaborator

@rharter any thoughts on how to go about this? Happy to take a crack at it if you have any ideas around it

@Meisolsson
Copy link
Contributor

@rharter Any news on this?

@dotgc
Copy link

dotgc commented Dec 15, 2016

Does this work when T itself is an AutoValue class? For me, it raises a "java.lang.IllegalArgumentException: Cannot serialize abstract class.." exception.

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

No branches or pull requests

5 participants