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

Initialize known collection types to empty instead of null #71

Merged
merged 1 commit into from
Oct 18, 2016

Conversation

cushon
Copy link
Contributor

@cushon cushon commented Oct 13, 2016

No description provided.

@JakeWharton
Copy link
Contributor

What about @Nullable properties. Should we allow them to be initialized to null since you've essentially opted into the behavior?

@cushon
Copy link
Contributor Author

cushon commented Oct 13, 2016

Should we allow them to be initialized to null since you've essentially opted into the behavior?

SGTM, I updated the pull request.

@rharter
Copy link
Owner

rharter commented Oct 18, 2016

Thanks @cushon, this looks great. I was initially thrown by the Immutable* additions, but that will only become a dependency if the app is already using Guava, so nothing is imposed on the user.

@rharter rharter merged commit 1556444 into rharter:master Oct 18, 2016
@rharter
Copy link
Owner

rharter commented Oct 18, 2016

@hzsweers has raised a valid concern that this breaks the AutoValue expectation that null collection and empty collections are different. If your collection property is non-nullable, then it should exist in your JSON. (i.e. if you deserialize JSON with this change, then serialize JSON it would be different).

I've opened issue #73 to discuss this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants