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

Avoid compiler warnings when deserializing to a parameterized type #248

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 2 comments
Closed

Comments

@GoogleCodeExporter
Copy link

Foo<Bar> foo = gson.fromJson(json, Foo.class);

currently produces compiler warning for unchecked conversion and needs 
@SuppressWarnings("unchecked")

Explore revising gson.fromJson(String json, Class<? super T> classOfT) to get 
rid of this warning.

Original issue reported on code.google.com by inder123 on 5 Oct 2010 at 1:53

@GoogleCodeExporter
Copy link
Author

There's nothing we can do here. The type of List.class is Class<List>, not the 
type we really want. The only typesafe option we have is to add an overload 
that accepts a TypeToken, and we've already decided not to go that route.

Original comment by limpbizkit on 3 Nov 2010 at 3:19

  • Changed state: WontFix

@GoogleCodeExporter
Copy link
Author

There's nothing we can do here. The type of List.class is Class<List>, not the 
type we really want. The only typesafe option we have is to add an overload 
that accepts a TypeToken, and we've already decided not to go that route.

Original comment by limpbizkit on 3 Nov 2010 at 3:19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant