-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add Gson.fromJson(..., TypeToken) overloads #1700
Commits on May 21, 2020
-
Add Gson.fromJson(..., TypeToken) overloads
Previously only Gson.fromJson(..., Type) existed which is however not type-safe since the generic type parameter T used for the return type is not bound. Since these methods are often used in the form gson.fromJson(..., new TypeToken<...>(){}.getType()) this commit now adds overloads which accept a TypeToken and are therefore more type-safe. Additional changes: - Fixed some grammar mistakes - Added javadoc @see tags - Consistently write "JSON" in uppercase - More precise placement of @SuppressWarnings("unchecked")
Configuration menu - View commit details
-
Copy full SHA for ab6284c - Browse repository at this point
Copy the full SHA ab6284cView commit details
Commits on Jun 10, 2020
-
Add to Gson.fromJson javadoc that JSON is fully consumed
The newly added documentation deliberately does not state which exception is thrown because Gson.assertFullConsumption could throw either a JsonIOException or a JsonSyntaxException.
Configuration menu - View commit details
-
Copy full SHA for 789bb16 - Browse repository at this point
Copy the full SHA 789bb16View commit details
Commits on Sep 2, 2020
-
Remove unnecessary wrapping and unwrapping as TypeToken in Gson.fromJson
Since the actual implementation of Gson.fromJson is TypeToken based, the TypeToken variant overloads are now the "main" implementation and the other overloads delegate to them. Previously the Type variant overloads were the "main" implementation which caused `TypeToken.getType()` followed by `TypeToken.get(...)` when the TypeToken variant overloads were used.
Configuration menu - View commit details
-
Copy full SHA for 3b64053 - Browse repository at this point
Copy the full SHA 3b64053View commit details -
Configuration menu - View commit details
-
Copy full SHA for 04fbb6d - Browse repository at this point
Copy the full SHA 04fbb6dView commit details -
Fix Gson.fromJson(JsonReader, Class) not casting read Object
To be consistent with the other Gson.fromJson(..., Class) overloads the method should cast the result.
Configuration menu - View commit details
-
Copy full SHA for 224db11 - Browse repository at this point
Copy the full SHA 224db11View commit details
Commits on Sep 16, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 8d010d5 - Browse repository at this point
Copy the full SHA 8d010d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for b38ef2c - Browse repository at this point
Copy the full SHA b38ef2cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 17b40f8 - Browse repository at this point
Copy the full SHA 17b40f8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 853d9f5 - Browse repository at this point
Copy the full SHA 853d9f5View commit details
Commits on Sep 18, 2022
-
Configuration menu - View commit details
-
Copy full SHA for c34ba6c - Browse repository at this point
Copy the full SHA c34ba6cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 43ebe28 - Browse repository at this point
Copy the full SHA 43ebe28View commit details
Commits on Sep 19, 2022
-
Remove fromJson(JsonReader, Class) again
As noticed during review adding this method is source incompatible.
Configuration menu - View commit details
-
Copy full SHA for 6ad87f0 - Browse repository at this point
Copy the full SHA 6ad87f0View commit details