You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
issue#2436: Throw exception when registering adapter for Object or JsonElement (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]>
`registerTypeAdapter` call checks if the type adapter implements more than one of these interfaces and register it for all of them.
408
+
`registerTypeAdapter` call checks
409
+
1. if the type adapter implements more than one of these interfaces, in that case it registers the adapter for all of them.
410
+
2. if the type adapter is for the Object class or JsonElement or any of its subclasses, in that case it throws IllegalArgumentException because overriding the built-in adapters for these types is not supported.
0 commit comments