PatchSetApproval: Replace copy constructors with instance methods

In a few cases, change the semantics to avoid the premature optimization
of returning the same instance if the patch set already matches. In the
near future in this series, PatchSetApproval will become deeply
immutable, so there will be no functional difference between different
instances.

Change-Id: Iba9e3d6f5fbd7a99ef015144b6550b67a73400be
This commit is contained in:
Dave Borowitz
2019-04-29 15:06:50 -07:00
parent df6fb38f21
commit 37ae6e17bc
6 changed files with 12 additions and 30 deletions

View File

@@ -341,7 +341,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
ImmutableListMultimap.Builder<PatchSet.Id, PatchSetApproval> b =
ImmutableListMultimap.builder();
for (Map.Entry<PatchSet.Id, PatchSetApproval> e : state.approvals()) {
b.put(e.getKey(), new PatchSetApproval(e.getValue()));
b.put(e.getKey(), e.getValue().copy());
}
approvals = b.build();
}