-
Notifications
You must be signed in to change notification settings - Fork 9
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
Usage of undocumented Gson.getDelegateAdapter(null, ...)
#129
Comments
Hello, thanks for the head's up about that upcoming change. Really appreciate it. What would be the benefit of switching to a TypeAdapterFactory? Performance wise, the TypeAdapter will be efficient because reflection calls are cached with our underlying implementation. Thanks a lot for your hints. Have a good day |
Mainly that it 'officially' supports the use case of looking up a delegate adapter. That delegate will be any other custom adapter you have registered for that type, or otherwise one of the built-in adapters, such as the reflection-based one. The documentation also has some examples for this, but basically your implementation of the In general using |
Thank you very much for your answer and all the explanations. Have a nice day, and thanks again PS : |
Hello,
your code uses
Gson.getDelegateAdapter(null, ...)
:https://github.com/vertigo-io/vertigo-extensions/blob/b0f90b5e1ef1c9649e7c0b463b316aa7220f1a15/vertigo-vega/src/main/java/io/vertigo/vega/engines/webservice/json/GoogleJsonEngine.java#L310
Using
null
as argument relies on undocumented Gson implementation details (which also haven't been consistent over the years). In upcoming Gson versionsnull
will be rejected as argument (see also google/gson#2435 (comment)).You can probably rewrite your code to use a custom Gson
TypeAdapterFactory
instead to achieve the same functionality. If you need help with that, feel free to let me know.The text was updated successfully, but these errors were encountered: