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
java.lang.IllegalArgumentException: Method return type must not include a type variable or wildcard: retrofit2.Call<model.DataModelResponse<T>> #2012
Comments
"Method return type must not include a type variable or wildcard " it seems to be clear |
You cannot. Type information needs to be fully known at runtime in order for deserialization to work. |
would be great |
So for example, a request such as: Sorry to bring up old issues... |
Yes. Retrofit has no idea what type to create to fulfill that contract.
…On Wed, Jul 19, 2017 at 8:53 PM Michael Barnett ***@***.***> wrote:
So for example, a request such as:
Call<T[]> call = apiService.getResources(...); where T extends Resource
would not be possible? (Resource being a class from the moshi-jsonapi
<https://github.com/kamikat/moshi-jsonapi> library, which allows you to
extend a class as a Resource.)
Would I then need to create a different retrofit API interface for each of
these Resources?
Sorry to bring up old issues...
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#2012 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEQBZjtVZlvDqL1k90Fi-rZLYoLV6ks5sPqUngaJpZM4J1bpG>
.
|
So... If I have 6 different types of resources, I'm going to create 6 different interfaces, and this is how people have been doing it the whole time? I'm sorry I'm just not sure what the alternative is here when trying to keep my code DRY. |
@lordplagus02
So here, the parsing dependency is upon you and not retrofit. Hope it helps. this way you can create just one interface for all object by ID queries, alternatively you can also add query map to add additional options and set null if not required. |
oh This will be very troublesome |
You can create these methods once and then you're done. A utility sort of thing |
yes It will work but May I have some more in explanation if possible with example with 2 or more service call |
I get this error because of proguard. In my interface I had a function that was not used anymore. Also the class of the return type was not used anymore in the project. I think proguard removed the return type class and made the return type of the function Call or Call<?>. The result was the same IllegalArgumentException as soon as the first http call started. |
It needs to fix proguard rules |
how define generic T class in interface api and rest mansger ?
api this
call rest manager this
rest manager this
The text was updated successfully, but these errors were encountered: