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

Code cleanup #2282

Merged
merged 22 commits into from Dec 13, 2022
Merged

Code cleanup #2282

merged 22 commits into from Dec 13, 2022

Conversation

MaicolAntali
Copy link
Contributor

I have cleanup the codebase

Copy link
Collaborator

@Marcono1234 Marcono1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for these changes!

Feel free to consider these review comments mostly as suggestions; Éamonn will probably provide the main review.

Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, some of these changes are clear improvements! I agree with @Marcono1234 about the formatting concerns, though, so can you fix those?

@MaicolAntali
Copy link
Contributor Author

MaicolAntali commented Dec 12, 2022

Yes, i read your suggestions and I agree. In the next days, when I have more free time, I will fix everything


EDIT: Well, I found the time today 😆

Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few good improvements here! Still a few nits, though.

@MaicolAntali
Copy link
Contributor Author

MaicolAntali commented Dec 12, 2022

If you want I can run in the google-java-format in the project so everything could be formatted. Let me know @eamonnmcmanus

@eamonnmcmanus
Copy link
Member

If you want I can run in the google-java-format in the project so everything could be formatted.

No, please don't do that. We should probably do it at some point, in a PR with no other changes, but we've hesitated to because it would mean any outstanding PRs would probably get a bunch of annoying merge work to do.

Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! Just one thing.

@MaicolAntali
Copy link
Contributor Author

MaicolAntali commented Dec 13, 2022

No, please don't do that.

Ohh yes, make sense. Thank you for explaining 😄


I'm still seeing changed indentation.

I don't know why Github don't show the indentation changes. If you look at this commit, for me it's fine

@eamonnmcmanus
Copy link
Member

The indentation problem is still there, including in the commit you referenced. It should look like this:

..public Date read(JsonReader in) throws IOException {
....try {
......switch (in.peek()) {
........case NULL:
..........in.nextNull();

but obviously with spaces instead of dots.

It doesn't look as if there are any real changes to that file anyway, so maybe just restore it to what it was?

(Also make sure that you don't have whitespace changes hidden: Files changed > ⚙️ > Hide whitespace.)

Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I hadn't realized that the indentation of the switch in UtcDateTypeAdapter did not follow Google style, since the case labels were at the same indentation as the switch. So thanks for fixing that.

@eamonnmcmanus eamonnmcmanus merged commit 0a42c31 into google:master Dec 13, 2022
@MaicolAntali
Copy link
Contributor Author

Most welcome! i'm happy to help 😃

@Marcono1234 Marcono1234 mentioned this pull request Dec 13, 2022
@MaicolAntali MaicolAntali deleted the cleanup branch December 16, 2022 15:26
tibor-universe pushed a commit to getuniverse/gson that referenced this pull request Jan 20, 2023
* Simplify `if` condition in JsonReader.peekNumber()

* Remove `if` to simplify a `return` in Excluder.excludeClassChecks()

* Remove redundant variable in Gson.fromJson()

* equal condition replace by `Objects.equals()` in $Gson$Types.equal()

* equal condition replace by `Objects.equals()` in LinkedTreeMap.equal()

* Replace `switch` with `if` in UtcDateTypeAdapter.read()

* Remove redundant `throws` clause in GraphAdapterBuilder.read()

* Remove redundant `throws` clause in JsonTreeReader.UNREADABLE_READER

* Remove redundant `throws` clause in JsonTreeWriter.UNREADABLE_READER

* Remove unnecessary `.initCause()` call

* Remove redundant cast in TreeTypeAdapter.GsonContextImpl.deserialize

* Replace `StringBuilder` with `String`

* Fix the import and restore the `switch`

* Fix the import

* Add the `util.Objects` import

* Fix indentation

* Add a comment to clarify the condition

* Fix indentation

* Fix imports

* Fix indentation

* Fix indentation

* Fix indentation

(cherry picked from commit 0a42c31)
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.

None yet

3 participants