-
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
GsonBuilder backwards compatibility broken, throws "Cannot override built-in adapter" error #2787
Comments
This change was intentional, see #2479 and #2436. The built-in adapter for It seems for java-cloudant that Maybe I am overlooking some corner case though, where this code in java-cloudant did / does actually make a difference. Otherwise, maybe one case where it is kind of possible to override the Footnotes
|
A GitHub search showed a few other cases of Maybe this as done as workaround for #362 (fixed by 65df3b9 in Gson 2.2.3); it seems back then no built-in adapter for |
@eamonnmcmanus, what do you think? Should we make these |
Gson version
2.11
Java / Android version
Semeru JDK 21.0.5
Used tools
Description
We are currently maintaining a legacy application in an ongoing support mode. In order to address security vulnerabilities, we needed to update several third-party dependencies, which required upgrading to Gson version 2.11. However, after the update, another dependency, com.cloudant:cloudant-client:2.20.1 (https://github.com/cloudant/java-cloudant), began to fail. This dependency worked correctly with Gson 2.10.1 but now fails with Gson 2.11. The error encountered is as follows:
The issue appears to be related to how GsonBuilder is used in the method defined in https://github.com/cloudant/java-cloudant/blob/master/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/GsonHelper.java
It seems that something has changed in GsonBuilder between versions 2.10.1 and 2.11 that is now causing a conflict and breaking backward compatibility. Could you clarify whether this is a bug, or is it the intended behavior in the new Gson version?
Expected behavior
Considering this was minor version update, I would expect that GsonBuilder would continue to work as it was.
Actual behavior
It seems that something has changed in GsonBuilder between versions 2.10.1 and 2.11 that is now causing a conflict and breaking backward compatibility.
Reproduction steps
https://github.com/cloudant/java-cloudant/blob/master/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/internal/GsonHelper.java should still be able to register TypeAdapter in GsonBuilder.
NOTE: I can't change com.cloudant:cloudant-client:2.20.1 code. I know that it's deprecated, sunset and no longer supported by any team - but to replace it with some other library is involved change. Therefore I am trying to rather ask if backward compatibility of GsonBuilder could be kept.
Exception stack trace
The text was updated successfully, but these errors were encountered: