Skip to content
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

Formalize null handling of type tokens #2030

Closed
wants to merge 1 commit into from

Conversation

nadiawoodninja
Copy link

@nadiawoodninja nadiawoodninja commented Dec 3, 2021

@google-cla google-cla bot added the cla: yes label Dec 3, 2021
Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

new Gson().getAdapter((TypeToken<Object>) null);
assertTrue("Unreachable", false);
}
catch (NullPointerException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you join this to the previous line?

} catch (NullPointerException e) {

// Note: ExpectedException cannot be used due to test suite extending TestCase
try {
new Gson().getAdapter((TypeToken<Object>) null);
assertTrue("Unreachable", false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fail() would be fine here.

Comment on lines +30 to +32
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports seem to be unused.

@@ -82,4 +86,16 @@ public void testClonedTypeAdapterFactoryListsAreIndependent() {
}
@Override public Object read(JsonReader in) throws IOException { return null; }
}

public void testNullAdapterLookup() {
// Formalize the handling of null type tokens (previously it was partially handled, but still throwing an error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this comment line here is useful in the test code. To me this message only seems to be relevant regarding why this pull request or commit was created, but not why this test exists.


Note that unlike eamonnmcmanus, I am not a member of this project. Feel free to consider my comments only as suggestion.

@Marcono1234
Copy link
Collaborator

I am closing this pull request because this issue has been fixed as part of #2153. Thanks nonetheless for your pull request!

@Marcono1234 Marcono1234 closed this Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants