Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Adding support to AutoValue.Id. #212
Conversation
…en an autoValue does not want to use all its fields in the equals() and hashcode() method.
|
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. |
|
I used another email account to submit this pull request. How can I associate this other account to my CLA account ? |
|
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++) { | |||
rdtorres
Mar 31, 2015
Author
This change has nothing to do with the commit. But I fixed it because checkstyle was complaining about it.
This change has nothing to do with the commit. But I fixed it because checkstyle was complaining about it.
| * @author Rafael Torres | ||
| */ | ||
| @AutoService(Processor.class) | ||
| public class AutoValueIdsProcessor extends AbstractProcessor { |
rdtorres
Mar 31, 2015
Author
I was not sure if I should create another processor to validate Id or if I should use AutoValueBuilderProcessor. My suggestion is to rename AutoValueBuilderProcessor to some generic name and use it to validate Builder, Validate and Id.
I was not sure if I should create another processor to validate Id or if I should use AutoValueBuilderProcessor. My suggestion is to rename AutoValueBuilderProcessor to some generic name and use it to validate Builder, Validate and Id.
|
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. |
|
I've read the documentation and I know that auto-value does not support it. Let me know what do you guys think. On Tue, Mar 31, 2015 at 2:03 PM, Éamonn McManus notifications@github.com
|
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.