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

Adding support to AutoValue.Id. #212

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rdtorres
Copy link

This new annotation should be used when an autoValue does not want to use all its fields in the equals() and hashcode() method. So, the autovalue bean can simple annotate all fields that should be used to unique identify that bean.

Let me know if you like it, so I can add more JUnit tests to cover edge cases.

…en an autoValue does not want to use all its fields in the equals() and hashcode() method.
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@rdtorres
Copy link
Author

I used another email account to submit this pull request. How can I associate this other account to my CLA account ?

@googlebot
Copy link

CLAs look good, thanks!

@@ -494,7 +504,7 @@ private void fixReservedIdentifiers(Map<ExecutableElement, String> methodToIdent
}

private String disambiguate(String name, Collection<String> existingNames) {
for (int i = 0; ; i++) {
Copy link
Author

Choose a reason for hiding this comment

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

This change has nothing to do with the commit. But I fixed it because checkstyle was complaining about it.

@eamonnmcmanus
Copy link
Member

eamonnmcmanus commented Mar 31, 2015

We explicitly say in the documentation that we don't support fields that don't participate in equals and hashCode. If we did want to do so, this would certainly be one way of going about it. In that case I think we would also want the ability to say, independently, whether a field appears in toString.
Pinging @kevinb9n.

@rdtorres
Copy link
Author

I've read the documentation and I know that auto-value does not support it.
In fact, this is the main reason behind this pull request: Add to support
to it =). The toString method can also follow a similar approach where an
annotation like "Autovalue.Printable" would indicate which fields should be
printed or not. Again, these annotations are extra, non-mandatory
annotations. So, default auto-model behaviour will be exactly the same as
we have nowadays...

Let me know what do you guys think.

On Tue, Mar 31, 2015 at 2:03 PM, Éamonn McManus notifications@github.com
wrote:

We explicitly say in the documentation
https://github.com/google/auto/tree/master/value#derived-fields that we
don't support fields that don't participate in equals and hashCode. If we
did want to do so, this would certainly be one way of going about it. In
that case I think we would also want the ability to say, independently,
whether a field appears in toString.
Pinging @kevinb9n https://github.com/kevinb9n.

Reply to this email directly or view it on GitHub
#212 (comment).

@cpovirk cpovirk added P3 type=addition A new feature labels Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants