-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalise ProtoRedundantSet to handle autovalues too.
PiperOrigin-RevId: 599119407
- Loading branch information
1 parent
bd0ba3f
commit 2cbed19
Showing
5 changed files
with
118 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Proto and AutoValue builders provide a fluent interface for constructing | ||
instances. Unlike argument lists, however, they do not prevent the user from | ||
providing multiple values for the same field. | ||
|
||
Setting the same field multiple times in the same chained expression is | ||
pointless (as the intermediate value will be overwritten), and can easily mask a | ||
bug, especially if the setter is called with *different* arguments. | ||
|
||
```java | ||
return MyProto.newBuilder() | ||
.setFoo(copy.getFoo()) | ||
.setFoo(copy.getBar()) | ||
.build(); | ||
``` |