-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform numeric conversion for primitive numeric type adapters (#2158)
* Perform numeric conversion for primitive numeric type adapters This should probably not be visible to the user unless they use the non-typesafe `Gson.toJson(Object, Type)` where unrelated number types can be used, or when malformed generic containers are used. For example a `List<Byte>` containing a Float. This change also has the advantage of avoiding `JsonWriter.value(Number)` for primitive type adapters. That method has some overhead because it needs to make sure that the value is a valid JSON number. However, for primitive numbers this check is redundant. * Don't call `JsonWriter.value(float)` for backward compatibility * Fix typo in comments
- Loading branch information
1 parent
796193d
commit 3e3266c
Showing
3 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters