-
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
Gson.getAdapter((TypeToken) null) throws exception #1831
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
Gson
class has logic for handlingnull
arguments forgetAdapter(TypeToken)
, see:gson/gson/src/main/java/com/google/gson/Gson.java
Line 434 in ceae88b
However, it appears the pull request which tried to keep the support for
null
arguments also broke it due to commit 31dcfa3 because it does not reassign a non-null
value to thetype
argument anymore which later on in the method causes aNullPointerException
.However that was 4 years ago and it appears support for
null
arguments might not have been used much (if at all; I did not find existing issues about this here on GitHub). Therefore maybe it would be better instead of fixing this issue to simply removenull
handling forgetAdapter(TypeToken)
completely and to throw an exception on purpose.The text was updated successfully, but these errors were encountered: