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

Add explicit support for floats in JsonWriter. #2130

Merged
merged 1 commit into from Jun 8, 2022

Conversation

Capstan
Copy link
Contributor

@Capstan Capstan commented Jun 8, 2022

This avoids floats being treated as doubles and having an unwarranted level of precision.

Fixes #1127.

@eamonnmcmanus eamonnmcmanus self-assigned this Jun 8, 2022
@eamonnmcmanus eamonnmcmanus self-requested a review Jun 8, 2022
Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Thanks, this looks great.

This avoids floats being treated as doubles and having an unwarranted level of precision.

Fixes google#1127.
@eamonnmcmanus eamonnmcmanus merged commit 96ab171 into google:master Jun 8, 2022
5 checks passed
@Capstan Capstan deleted the issues-1127 branch Jun 9, 2022
@Marcono1234
Copy link
Collaborator

Marcono1234 commented Jun 10, 2022

Could you please also override this new method in JsonTreeWriter? Otherwise users will experience an AssertionError.

@Capstan Capstan restored the issues-1127 branch Jun 10, 2022
Capstan added a commit to Capstan/gson that referenced this pull request Jun 10, 2022
Follow-up to comments on google#2130, which introduced a new override which was not overridden by JsonTreeWriter. Also tweaks the doccomments for both float and double varients of JsonWriter.value.

Supplement to the fix for google#1127.
Capstan added a commit to Capstan/gson that referenced this pull request Jun 11, 2022
Follow-up to comments on google#2130, which introduced a new override which was not overridden by `JsonTreeWriter`. Also tweaks the doccomments for `float`, `double` and `Number` variants of `JsonWriter.value`.

Supplement to the fix for google#1127.
eamonnmcmanus pushed a commit that referenced this pull request Jun 21, 2022
Follow-up to comments on #2130, which introduced a new override which was not overridden by `JsonTreeWriter`. Also tweaks the doccomments for `float`, `double` and `Number` variants of `JsonWriter.value`.

Supplement to the fix for #1127.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JsonWriter don't work correctly with float
3 participants