-
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
issue#2436: Throw exception when registering adapter for Object or JsonElement #2479
issue#2436: Throw exception when registering adapter for Object or JsonElement #2479
Conversation
… to register adapter for Object or JsonElement
…cases and fix for 7 test cases of Parameterized Type
There was a problem hiding this 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 your changes! They look pretty good.
Could you please edit the title of your pull request? I think GitHub will otherwise use it by default as commit message. For example what about the following?
Throw exception when registering adapter for Object or JsonElement
I have added a few review comments; some are only related to formatting and wording (feel free to use a better wording than what I proposed). Though in general feel free to consider my review comments mostly as suggestions since I am not a direct member of this project.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes already!
You can change the title of the pull request by clicking the "Edit" button at the top right of the pull request.
Also, there are a few comments still unresolved, unfortunately the GitHub UI has the bad habit of hiding them regardless of whether they are resolved or not...
You can also see all unresolved comments on the "Files changes" tab under "Conversations", see also the GitHub documentation.
…achinp97/gson into feature/issue#2436_enhancement
@Marcono1234 @eamonnmcmanus , I have pushed the changes as per review. Thanks for great review and comments! |
There was a problem hiding this 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. I'm running it against all of Google's internal tests just to make sure there are no unexpected problems.
A couple of small things. And also, could you update the CL with the latest changes from HEAD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your changes!
In addition to Éamonn's comments I added a few small additional comments but besides that the pull request looks fine to me as well.
If you want you can also directly apply the suggested changes from the GitHub UI. (Also don't worry too much about the commit messages; the commits will be squashed into a single commit here anyways when merged.)
Co-authored-by: Marcono1234 <[email protected]>
Co-authored-by: Marcono1234 <[email protected]>
Co-authored-by: Marcono1234 <[email protected]>
Thanks @eamonnmcmanus and @Marcono1234 again for final reviews, please confirm so I can merge and close it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If @Marcono1234 is also OK with these changes we can merge them.
I don't have a write access to this repository, @Marcono1234 can you suggest if we are good and anyone can merge the PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes for me this is fine as well, thanks a lot for your work on this!
…onElement (google#2479) * Code changes and tests for google#2436 to throw exception when trying to register adapter for Object or JsonElement * google#2436 - Updates to User guide & comments to indicate exception cases and fix for 7 test cases of Parameterized Type * google#2436 - Fixes as per the review comments. * google#2436 - Refactored as per latest review comments + throwing error message. * google#2436 - added a clarifying comment in a positive test case. * google#2436 - formatting and minor changes as per review. * Update gson/src/main/java/com/google/gson/GsonBuilder.java Co-authored-by: Marcono1234 <[email protected]> * Update gson/src/test/java/com/google/gson/GsonBuilderTest.java Co-authored-by: Marcono1234 <[email protected]> * Update gson/src/test/java/com/google/gson/GsonBuilderTest.java Co-authored-by: Marcono1234 <[email protected]> --------- Co-authored-by: Sachin Patil <[email protected]> Co-authored-by: Marcono1234 <[email protected]>
Purpose
Closes #2436 to throw IllegalArgumentException for certain Types
Description
Implementation includes a check of Type of an Object class or assignable from JsonElements (i.e. subclass or self).
It seems following use cases of Parameterized Type failed after latest changes.
Additional Fix also excludes Parameterized Type that cover 7 other test cases.
Checklist
null
@since $next-version$
(
$next-version$
is a special placeholder which is automatically replaced during release)TestCase
)mvn clean verify javadoc:jar
passes without errors