Replace account.AccountInfo with extensions.common.AccountInfo

These have identical public fields; the only difference is that
AccountInfo.Loader was using the transient _id field store the ID
before filling in values. We can instead reuse the Integer _accountId
field for this purpose. This may incur an additional boxing or so per
account per request, but that cost should be negligible given how
many allocations we do per request already.

AccountInfoMapper is no longer required, so remove that entirely.

We are now enforcing that AccountInfos passed to the loader have an
_accountId. Since by default the old account.AccountInfo worked
without an _accountId, add this as a separate FillOption and clear it
if that option is not set. To verify this, check the owner fields in
ChangeIT#get.

Change-Id: Ied01750485cc728e91e585a31f3db8863bae7e40
This commit is contained in:
Dave Borowitz
2014-11-25 14:41:05 -05:00
parent 5df54ae192
commit 54ba43a51d
34 changed files with 259 additions and 272 deletions

View File

@@ -39,9 +39,9 @@ import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountInfo;
import com.google.gerrit.server.account.AccountsCollection;
import com.google.gerrit.server.account.GroupMembers;
import com.google.gerrit.server.account.AccountLoader;
import com.google.gerrit.server.change.ReviewerJson.PostResult;
import com.google.gerrit.server.change.ReviewerJson.ReviewerInfo;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -81,7 +81,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
private final AddReviewerSender.Factory addReviewerSenderFactory;
private final GroupsCollection groupsCollection;
private final GroupMembers.Factory groupMembersFactory;
private final AccountInfo.Loader.Factory accountLoaderFactory;
private final AccountLoader.Factory accountLoaderFactory;
private final Provider<ReviewDb> dbProvider;
private final ChangeUpdate.Factory updateFactory;
private final Provider<CurrentUser> currentUser;
@@ -99,7 +99,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
AddReviewerSender.Factory addReviewerSenderFactory,
GroupsCollection groupsCollection,
GroupMembers.Factory groupMembersFactory,
AccountInfo.Loader.Factory accountLoaderFactory,
AccountLoader.Factory accountLoaderFactory,
Provider<ReviewDb> db,
ChangeUpdate.Factory updateFactory,
Provider<CurrentUser> currentUser,