Android : android retrofit callback generics

on Sunday, February 15, 2015


I have an interface like this:



@POST("/")
public void foo(Callback<MyObject> callback);


I want to be able to do something like this:



@POST("/")
public void foo(Callback<? extends MyObject> callback);


However, when I call foo(MyObjectExtended), where "MyObjectExtended" extends MyObject, I get a runtime exception, stating, that the fields of "MyObjectExtended" can't be parsed.


Is there a way to fix this?


0 comments:

Post a Comment