-
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
TypeAdapterFactory INTEGER_FACTORY will change INTEGER type to LONG type #2680
Comments
Yes can confirm this; it looks like this was indeed introduced by 3e3266c (by accident): Sorry for that. Maybe it would make sense to (partially) revert that commit. It seems |
Ok, so the potential issues with the current implementation are:
Reverting 3e3266c (or at least parts of it) would also revert narrowing numeric conversion, e.g. Maybe So am I currently not sure what the best approach here would be. |
Gson version
2.10.1
Java / Android version
21
Description
I try to get a JsonElement by toJsonTree method. but i found that when i use integer object as input, i will get a long object with method
JsonElement.getAsNumber()
I think this commit caused this problem:3e3266c
Is this a bug or a feature?
Expected behavior
use integer type as input, get integer type as output
Actual behavior
use integer type as input, get long type as output
Reproduction steps
The text was updated successfully, but these errors were encountered: