Merge "Consistently don't import Id/Key/NameKey/Entry types"

This commit is contained in:
David Pursehouse
2019-01-18 10:13:12 +00:00
committed by Gerrit Code Review
36 changed files with 83 additions and 104 deletions

View File

@@ -20,7 +20,6 @@ import com.google.gerrit.index.query.DataSource;
import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Change.Id;
import com.google.gerrit.server.index.change.ChangeIndex;
import com.google.gerrit.server.query.change.ChangeData;
import java.io.IOException;
@@ -59,7 +58,7 @@ public class DisabledChangeIndex implements ChangeIndex {
}
@Override
public void delete(Id key) throws IOException {
public void delete(Change.Id key) throws IOException {
throw new UnsupportedOperationException("ChangeIndex is disabled");
}

View File

@@ -19,7 +19,7 @@ import com.google.gerrit.index.Schema;
import com.google.gerrit.index.query.DataSource;
import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.reviewdb.client.Change.Id;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.server.index.change.ChangeIndex;
import com.google.gerrit.server.query.change.ChangeData;
import java.io.IOException;
@@ -51,7 +51,7 @@ class ReadOnlyChangeIndex implements ChangeIndex {
}
@Override
public void delete(Id key) throws IOException {
public void delete(Change.Id key) throws IOException {
// do nothing
}

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.acceptance.testsuite.project;
import com.google.common.base.Preconditions;
import com.google.gerrit.acceptance.testsuite.project.TestProjectCreation.Builder;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.NameKey;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.project.CreateProjectArgs;
@@ -63,7 +62,7 @@ public class ProjectOperationsImpl implements ProjectOperations {
}
@Override
public ProjectOperations.PerProjectOperations project(NameKey key) {
public ProjectOperations.PerProjectOperations project(Project.NameKey key) {
return new PerProjectOperations(key);
}

View File

@@ -40,7 +40,6 @@ import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Change.Id;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.converter.ChangeProtoConverter;
import com.google.gerrit.reviewdb.converter.PatchSetApprovalProtoConverter;
@@ -181,7 +180,7 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
}
@Override
protected String getDeleteActions(Id c) {
protected String getDeleteActions(Change.Id c) {
if (client.adapter().usePostV5Type()) {
return delete(ElasticQueryAdapter.POST_V5_TYPE, c);
}

View File

@@ -25,7 +25,6 @@ import static org.eclipse.jgit.util.HttpSupport.HDR_PRAGMA;
import com.google.gerrit.common.Version;
import com.google.gerrit.server.tools.ToolsCatalog;
import com.google.gerrit.server.tools.ToolsCatalog.Entry;
import com.google.gerrit.util.http.RequestUtil;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -50,7 +49,7 @@ public class ToolServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
Entry ent = toc.get(req.getPathInfo());
ToolsCatalog.Entry ent = toc.get(req.getPathInfo());
if (ent == null) {
rsp.sendError(SC_NOT_FOUND);
return;
@@ -71,7 +70,7 @@ public class ToolServlet extends HttpServlet {
}
}
private void doGetFile(Entry ent, HttpServletResponse rsp) throws IOException {
private void doGetFile(ToolsCatalog.Entry ent, HttpServletResponse rsp) throws IOException {
byte[] tosend = ent.getBytes();
rsp.setDateHeader(HDR_EXPIRES, 0L);
@@ -84,8 +83,8 @@ public class ToolServlet extends HttpServlet {
}
}
private void doGetDirectory(Entry ent, HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
private void doGetDirectory(
ToolsCatalog.Entry ent, HttpServletRequest req, HttpServletResponse rsp) throws IOException {
String path = "/tools/" + ent.getPath();
Document page = newDocument();
@@ -108,9 +107,9 @@ public class ToolServlet extends HttpServlet {
Element ul = page.createElement("ul");
body.appendChild(ul);
for (Entry e : ent.getChildren()) {
for (ToolsCatalog.Entry e : ent.getChildren()) {
String name = e.getName();
if (e.getType() == Entry.Type.DIR && !name.endsWith("/")) {
if (e.getType() == ToolsCatalog.Entry.Type.DIR && !name.endsWith("/")) {
name += "/";
}

View File

@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.WeakHashMap;
/** Helper class to define and parse options from plugins on ssh and RestAPI commands. */
@@ -267,7 +266,7 @@ public class DynamicOptions {
}
public void parseDynamicBeans(CmdLineParser clp) {
for (Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
for (Map.Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
clp.parseWithPrefix("--" + e.getKey(), e.getValue());
}
clp.drainOptionQueue();
@@ -276,14 +275,14 @@ public class DynamicOptions {
public void setDynamicBeans() {
if (bean instanceof BeanReceiver) {
BeanReceiver receiver = (BeanReceiver) bean;
for (Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
for (Map.Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
receiver.setDynamicBean(e.getKey(), e.getValue());
}
}
}
public void onBeanParseStart() {
for (Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
for (Map.Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
DynamicBean instance = e.getValue();
if (instance instanceof BeanParseListener) {
BeanParseListener listener = (BeanParseListener) instance;
@@ -293,7 +292,7 @@ public class DynamicOptions {
}
public void onBeanParseEnd() {
for (Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
for (Map.Entry<String, DynamicBean> e : beansByPlugin.entrySet()) {
DynamicBean instance = e.getValue();
if (instance instanceof BeanParseListener) {
BeanParseListener listener = (BeanParseListener) instance;

View File

@@ -21,7 +21,6 @@ import static java.util.stream.Collectors.toSet;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Comment;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSet.Id;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.patch.PatchListCache;
import com.google.gerrit.server.patch.PatchListNotAvailableException;
@@ -55,7 +54,7 @@ public class PublishCommentUtil {
return;
}
Map<Id, PatchSet> patchSets =
Map<PatchSet.Id, PatchSet> patchSets =
psUtil.getAsMap(notes, drafts.stream().map(d -> psId(notes, d)).collect(toSet()));
for (Comment d : drafts) {
PatchSet ps = patchSets.get(psId(notes, d));

View File

@@ -50,7 +50,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.CommitBuilder;
@@ -574,7 +573,7 @@ public class Preferences {
}
int i = 1;
for (Entry<String, String> e : urlAliases.entrySet()) {
for (Map.Entry<String, String> e : urlAliases.entrySet()) {
cfg.setString(URL_ALIAS, URL_ALIAS + i, KEY_MATCH, e.getKey());
cfg.setString(URL_ALIAS, URL_ALIAS + i, KEY_TOKEN, e.getValue());
i++;

View File

@@ -41,7 +41,6 @@ import com.google.gerrit.extensions.common.ApprovalInfo;
import com.google.gerrit.extensions.common.LabelInfo;
import com.google.gerrit.extensions.common.VotingRangeInfo;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.server.ApprovalsUtil;
@@ -287,7 +286,8 @@ public class LabelsJson {
}
Set<String> labelNames = new HashSet<>();
SetMultimap<Id, PatchSetApproval> current = MultimapBuilder.hashKeys().hashSetValues().build();
SetMultimap<Account.Id, PatchSetApproval> current =
MultimapBuilder.hashKeys().hashSetValues().build();
for (PatchSetApproval a : cd.currentApprovals()) {
allUsers.add(a.getAccountId());
LabelType type = labelTypes.byLabel(a.getLabelId());
@@ -441,13 +441,13 @@ public class LabelsJson {
// Include a user in the output for this label if either:
// - They are an explicit reviewer.
// - They ever voted on this change.
Set<Id> allUsers = new HashSet<>();
Set<Account.Id> allUsers = new HashSet<>();
allUsers.addAll(cd.reviewers().byState(ReviewerStateInternal.REVIEWER));
for (PatchSetApproval psa : cd.approvals().values()) {
allUsers.add(psa.getAccountId());
}
Table<Id, String, PatchSetApproval> current =
Table<Account.Id, String, PatchSetApproval> current =
HashBasedTable.create(allUsers.size(), cd.getLabelTypes().getLabelTypes().size());
for (PatchSetApproval psa : cd.currentApprovals()) {
current.put(psa.getAccountId(), psa.getLabel(), psa);

View File

@@ -33,7 +33,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.jgit.errors.ConfigInvalidException;
@Singleton
@@ -80,7 +79,7 @@ public class NotifyUtil {
}
ListMultimap<RecipientType, Account.Id> m = null;
for (Entry<RecipientType, NotifyInfo> e : notifyDetails.entrySet()) {
for (Map.Entry<RecipientType, NotifyInfo> e : notifyDetails.entrySet()) {
List<String> accounts = e.getValue().accounts;
if (accounts != null) {
if (m == null) {

View File

@@ -47,7 +47,6 @@ import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Patch;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSet.Id;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.AnonymousUser;
import com.google.gerrit.server.CurrentUser;
@@ -212,7 +211,7 @@ public class RevisionJson {
AccountLoader accountLoader,
ChangeData cd,
Map<PatchSet.Id, PatchSet> map,
Optional<Id> limitToPsId,
Optional<PatchSet.Id> limitToPsId,
ChangeInfo changeInfo)
throws PatchListNotAvailableException, GpgException, OrmException, IOException,
PermissionBackendException {

View File

@@ -63,7 +63,6 @@ import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
@@ -182,7 +181,7 @@ public class StreamEventsApiListener
private static Map<String, Short> convertApprovalsMap(Map<String, ApprovalInfo> approvals) {
Map<String, Short> result = new HashMap<>();
for (Entry<String, ApprovalInfo> e : approvals.entrySet()) {
for (Map.Entry<String, ApprovalInfo> e : approvals.entrySet()) {
Short value = e.getValue().value == null ? null : e.getValue().value.shortValue();
result.put(e.getKey(), value);
}
@@ -190,7 +189,7 @@ public class StreamEventsApiListener
}
private ApprovalAttribute getApprovalAttribute(
LabelTypes labelTypes, Entry<String, Short> approval, Map<String, Short> oldApprovals) {
LabelTypes labelTypes, Map.Entry<String, Short> approval, Map<String, Short> oldApprovals) {
ApprovalAttribute a = new ApprovalAttribute();
a.type = approval.getKey();
@@ -220,7 +219,7 @@ public class StreamEventsApiListener
if (approvals.size() > 0) {
ApprovalAttribute[] r = new ApprovalAttribute[approvals.size()];
int i = 0;
for (Entry<String, Short> approval : approvals.entrySet()) {
for (Map.Entry<String, Short> approval : approvals.entrySet()) {
r[i++] =
getApprovalAttribute(labelTypes, approval, convertApprovalsMap(oldApprovals));
}

View File

@@ -41,7 +41,6 @@ import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.LabelId;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSet.Id;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.server.ApprovalsUtil;
import com.google.gerrit.server.IdentifiedUser;
@@ -575,7 +574,7 @@ public class MergeUtil {
* @return new message
*/
public String createCommitMessageOnSubmit(
RevCommit n, RevCommit mergeTip, ChangeNotes notes, Id id) {
RevCommit n, RevCommit mergeTip, ChangeNotes notes, PatchSet.Id id) {
return commitMessageGenerator.generate(
n, mergeTip, notes.getChange().getDest(), createDetailedCommitMessage(n, notes, id));
}

View File

@@ -39,7 +39,6 @@ import com.google.gerrit.server.git.DefaultAdvertiseRefsHook;
import com.google.gerrit.server.git.MultiProgressMonitor;
import com.google.gerrit.server.git.ProjectRunnable;
import com.google.gerrit.server.git.TransferConfig;
import com.google.gerrit.server.git.receive.ResultChangeIds.Key;
import com.google.gerrit.server.permissions.PermissionBackend;
import com.google.gerrit.server.permissions.PermissionBackend.RefFilterOptions;
import com.google.gerrit.server.permissions.PermissionBackendException;
@@ -344,14 +343,14 @@ public class AsyncReceiveCommits implements PreReceiveHook {
int totalChanges = 0;
if (resultChangeIds.isMagicPush()) {
List<Change.Id> created = resultChangeIds.get(Key.CREATED);
metrics.changes.record(Key.CREATED, created.size());
List<Change.Id> replaced = resultChangeIds.get(Key.REPLACED);
metrics.changes.record(Key.REPLACED, replaced.size());
List<Change.Id> created = resultChangeIds.get(ResultChangeIds.Key.CREATED);
metrics.changes.record(ResultChangeIds.Key.CREATED, created.size());
List<Change.Id> replaced = resultChangeIds.get(ResultChangeIds.Key.REPLACED);
metrics.changes.record(ResultChangeIds.Key.REPLACED, replaced.size());
totalChanges += replaced.size() + created.size();
} else {
List<Change.Id> autoclosed = resultChangeIds.get(Key.AUTOCLOSED);
metrics.changes.record(Key.AUTOCLOSED, autoclosed.size());
List<Change.Id> autoclosed = resultChangeIds.get(ResultChangeIds.Key.AUTOCLOSED);
metrics.changes.record(ResultChangeIds.Key.AUTOCLOSED, autoclosed.size());
}
if (totalChanges > 0) {

View File

@@ -110,7 +110,6 @@ import com.google.gerrit.server.git.MultiProgressMonitor.Task;
import com.google.gerrit.server.git.ReceivePackInitializer;
import com.google.gerrit.server.git.TagCache;
import com.google.gerrit.server.git.ValidationError;
import com.google.gerrit.server.git.receive.ResultChangeIds.Key;
import com.google.gerrit.server.git.validators.CommitValidationMessage;
import com.google.gerrit.server.git.validators.RefOperationValidationException;
import com.google.gerrit.server.git.validators.RefOperationValidators;
@@ -810,8 +809,10 @@ class ReceiveCommits {
replaceByChange
.values()
.stream()
.forEach(req -> resultChangeIds.add(Key.REPLACED, req.ontoChange));
newChanges.stream().forEach(req -> resultChangeIds.add(Key.CREATED, req.changeId));
.forEach(req -> resultChangeIds.add(ResultChangeIds.Key.REPLACED, req.ontoChange));
newChanges
.stream()
.forEach(req -> resultChangeIds.add(ResultChangeIds.Key.CREATED, req.changeId));
if (magicBranchCmd != null) {
magicBranchCmd.setResult(OK);
@@ -3176,7 +3177,7 @@ class ReceiveCommits {
// If we are here, we didn't throw UpdateException. Record the result.
// The ordering is indeterminate due to the HashSet; unfortunately, Change.Id doesn't
// fit into TreeSet.
ids.stream().forEach(id -> resultChangeIds.add(Key.AUTOCLOSED, id));
ids.stream().forEach(id -> resultChangeIds.add(ResultChangeIds.Key.AUTOCLOSED, id));
return null;
},

View File

@@ -32,7 +32,6 @@ import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.BooleanProjectConfig;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Branch.NameKey;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.GerritPersonIdent;
@@ -158,7 +157,7 @@ public class CommitValidators {
public CommitValidators forGerritCommits(
PermissionBackend.ForProject forProject,
NameKey branch,
Branch.NameKey branch,
IdentifiedUser user,
SshInfo sshInfo,
RevWalk rw,

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.group;
import com.google.common.collect.ImmutableSet;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.AuditEvent;
import java.sql.Timestamp;
@@ -27,7 +26,7 @@ public interface GroupAuditService {
void dispatchAddMembers(
Account.Id actor,
AccountGroup.UUID updatedGroup,
ImmutableSet<Id> addedMembers,
ImmutableSet<Account.Id> addedMembers,
Timestamp addedOn);
void dispatchDeleteMembers(

View File

@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Comment;
import com.google.gerrit.reviewdb.client.Comment.Key;
import com.google.gerrit.reviewdb.client.CommentRange;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.RevId;
@@ -71,7 +70,7 @@ public class LegacyChangeNoteRead {
if (p.value >= note.length) {
return ImmutableList.of();
}
Set<Key> seen = new HashSet<>();
Set<Comment.Key> seen = new HashSet<>();
List<Comment> result = new ArrayList<>();
int sizeOfNote = note.length;
byte[] psb = ChangeNoteUtil.PATCH_SET.getBytes(UTF_8);

View File

@@ -55,7 +55,6 @@ import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Set;
import java.util.TreeSet;
@@ -431,20 +430,21 @@ public class PluginLoader implements LifecycleListener {
cleanInBackground();
}
private void addAllEntries(Map<String, Path> from, TreeSet<Entry<String, Path>> to) {
Iterator<Entry<String, Path>> it = from.entrySet().iterator();
private void addAllEntries(Map<String, Path> from, TreeSet<Map.Entry<String, Path>> to) {
Iterator<Map.Entry<String, Path>> it = from.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Path> entry = it.next();
Map.Entry<String, Path> entry = it.next();
to.add(new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue()));
}
}
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet(Map<String, Path> activePlugins) {
TreeSet<Entry<String, Path>> sortedPlugins =
private TreeSet<Map.Entry<String, Path>> jarsFirstSortedPluginsSet(
Map<String, Path> activePlugins) {
TreeSet<Map.Entry<String, Path>> sortedPlugins =
Sets.newTreeSet(
new Comparator<Entry<String, Path>>() {
new Comparator<Map.Entry<String, Path>>() {
@Override
public int compare(Entry<String, Path> e1, Entry<String, Path> e2) {
public int compare(Map.Entry<String, Path> e1, Map.Entry<String, Path> e2) {
Path n1 = e1.getValue().getFileName();
Path n2 = e2.getValue().getFileName();
return ComparisonChain.start()

View File

@@ -75,7 +75,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -1481,7 +1480,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
rc.unsetSection(PLUGIN, name);
}
for (Entry<String, Config> e : pluginConfigs.entrySet()) {
for (Map.Entry<String, Config> e : pluginConfigs.entrySet()) {
String plugin = e.getKey();
Config pluginConfig = e.getValue();
for (String name : pluginConfig.getNames(PLUGIN, plugin)) {

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.project;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.NameKey;
import com.google.gerrit.server.change.IncludedInResolver;
import com.google.gerrit.server.permissions.PermissionBackend;
import com.google.gerrit.server.permissions.PermissionBackend.RefFilterOptions;
@@ -48,7 +47,8 @@ public class Reachable {
}
/** @return true if a commit is reachable from a given set of refs. */
public boolean fromRefs(NameKey project, Repository repo, RevCommit commit, List<Ref> refs) {
public boolean fromRefs(
Project.NameKey project, Repository repo, RevCommit commit, List<Ref> refs) {
try (RevWalk rw = new RevWalk(repo)) {
Map<String, Ref> filtered =
permissionBackend

View File

@@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project.NameKey;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.plugincontext.PluginSetContext;
import com.google.gerrit.server.plugincontext.PluginSetEntryContext;
@@ -125,13 +125,13 @@ public class DefaultQuotaBackend implements QuotaBackend {
}
@Override
public QuotaBackend.WithResource project(NameKey project) {
public QuotaBackend.WithResource project(Project.NameKey project) {
QuotaRequestContext ctx = requestContext.toBuilder().project(project).build();
return new WithResource(quotaEnforcers, ctx);
}
@Override
public QuotaBackend.WithResource change(Change.Id change, NameKey project) {
public QuotaBackend.WithResource change(Change.Id change, Project.NameKey project) {
QuotaRequestContext ctx = requestContext.toBuilder().change(change).project(project).build();
return new WithResource(quotaEnforcers, ctx);
}

View File

@@ -32,7 +32,6 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.reviewdb.client.Comment;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.Project;
@@ -170,7 +169,7 @@ public class DeleteDraftComments
private final Account.Id accountId;
private DeletedDraftCommentInfo result;
Op(CommentFormatter commentFormatter, Id accountId) {
Op(CommentFormatter commentFormatter, Account.Id accountId) {
this.commentFormatter = commentFormatter;
this.accountId = accountId;
}

View File

@@ -50,7 +50,6 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -190,7 +189,7 @@ public class ReviewerRecommender {
}
// Sort results
Stream<Entry<Account.Id, MutableDouble>> sorted =
Stream<Map.Entry<Account.Id, MutableDouble>> sorted =
reviewerScores
.entrySet()
.stream()

View File

@@ -55,7 +55,6 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
@@ -192,10 +191,10 @@ public class PutConfig implements RestModifyView<ProjectResource, ConfigInput> {
ProjectConfig projectConfig,
Map<String, Map<String, ConfigValue>> pluginConfigValues)
throws BadRequestException {
for (Entry<String, Map<String, ConfigValue>> e : pluginConfigValues.entrySet()) {
for (Map.Entry<String, Map<String, ConfigValue>> e : pluginConfigValues.entrySet()) {
String pluginName = e.getKey();
PluginConfig cfg = projectConfig.getPluginConfig(pluginName);
for (Entry<String, ConfigValue> v : e.getValue().entrySet()) {
for (Map.Entry<String, ConfigValue> v : e.getValue().entrySet()) {
ProjectConfigEntry projectConfigEntry = pluginConfigEntries.get(pluginName, v.getKey());
if (projectConfigEntry != null) {
if (!PARAMETER_NAME_PATTERN.matcher(v.getKey()).matches()) {

View File

@@ -15,7 +15,7 @@
package com.google.gerrit.server.restapi.project;
import com.google.common.base.CaseFormat;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
@@ -23,7 +23,7 @@ public class RepositoryStatistics extends TreeMap<String, Object> {
private static final long serialVersionUID = 1L;
RepositoryStatistics(Properties p) {
for (Entry<Object, Object> e : p.entrySet()) {
for (Map.Entry<Object, Object> e : p.entrySet()) {
put(
CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, e.getKey().toString()),
e.getValue());

View File

@@ -27,7 +27,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.server.AccessPath;
import com.google.gerrit.server.tools.ToolsCatalog;
import com.google.gerrit.server.tools.ToolsCatalog.Entry;
import com.google.gerrit.sshd.BaseCommand;
import com.google.inject.Inject;
import java.io.ByteArrayOutputStream;
@@ -104,14 +103,14 @@ final class ScpCommand extends BaseCommand {
root = "";
}
final Entry ent = toc.get(root);
final ToolsCatalog.Entry ent = toc.get(root);
if (ent == null) {
throw new IOException(root + " not found");
} else if (Entry.Type.FILE == ent.getType()) {
} else if (ToolsCatalog.Entry.Type.FILE == ent.getType()) {
readFile(ent);
} else if (Entry.Type.DIR == ent.getType()) {
} else if (ToolsCatalog.Entry.Type.DIR == ent.getType()) {
if (!opt_r) {
throw new IOException(root + " not a regular file");
}
@@ -156,7 +155,7 @@ final class ScpCommand extends BaseCommand {
}
}
private void readFile(Entry ent) throws IOException {
private void readFile(ToolsCatalog.Entry ent) throws IOException {
byte[] data = ent.getBytes();
if (data == null) {
throw new FileNotFoundException(ent.getPath());
@@ -170,12 +169,12 @@ final class ScpCommand extends BaseCommand {
readAck();
}
private void readDir(Entry dir) throws IOException {
private void readDir(ToolsCatalog.Entry dir) throws IOException {
header(dir, 0);
readAck();
for (Entry e : dir.getChildren()) {
if (Entry.Type.DIR == e.getType()) {
for (ToolsCatalog.Entry e : dir.getChildren()) {
if (ToolsCatalog.Entry.Type.DIR == e.getType()) {
readDir(e);
} else {
readFile(e);
@@ -187,7 +186,8 @@ final class ScpCommand extends BaseCommand {
readAck();
}
private void header(Entry dir, int len) throws IOException, UnsupportedEncodingException {
private void header(ToolsCatalog.Entry dir, int len)
throws IOException, UnsupportedEncodingException {
final StringBuilder buf = new StringBuilder();
switch (dir.getType()) {
case DIR:

View File

@@ -47,7 +47,6 @@ import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.sshd.common.io.IoAcceptor;
import org.apache.sshd.common.io.IoSession;
import org.apache.sshd.common.io.mina.MinaSession;
@@ -267,7 +266,7 @@ final class ShowCaches extends SshCommand {
stdout.print(String.format(" %14s", s.name()));
}
stdout.print('\n');
for (Entry<String, Map<Thread.State, Integer>> e : threadSummary.counts.entrySet()) {
for (Map.Entry<String, Map<Thread.State, Integer>> e : threadSummary.counts.entrySet()) {
stdout.print(String.format(" %-22s", e.getKey()));
for (Thread.State s : Thread.State.values()) {
stdout.print(String.format(" %14d", nullToZero(e.getValue().get(s))));

View File

@@ -24,7 +24,7 @@ import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
import java.lang.reflect.ParameterizedType;
import java.util.Map.Entry;
import java.util.Map;
@Singleton
public class OptionHandlers {
@@ -53,7 +53,7 @@ public class OptionHandlers {
private static ImmutableMap<Class<?>, Provider<OptionHandlerFactory<?>>> build(Injector i) {
ImmutableMap.Builder<Class<?>, Provider<OptionHandlerFactory<?>>> map = ImmutableMap.builder();
for (; i != null; i = i.getParent()) {
for (Entry<Key<?>, Binding<?>> e : i.getBindings().entrySet()) {
for (Map.Entry<Key<?>, Binding<?>> e : i.getBindings().entrySet()) {
TypeLiteral<?> type = e.getKey().getTypeLiteral();
if (type.getRawType() == OptionHandlerFactory.class
&& e.getKey().getAnnotation() == null

View File

@@ -26,7 +26,6 @@ import com.google.gerrit.extensions.client.ChangeStatus;
import com.google.gerrit.extensions.client.SubmitType;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.NameKey;
import com.google.gerrit.server.change.TestSubmitInput;
import com.google.gerrit.testing.ConfigSuite;
import java.util.ArrayDeque;
@@ -273,7 +272,7 @@ public class SubmoduleSubscriptionsWholeTopicMergeIT extends AbstractSubmoduleSu
@Test
public void updateManySubmodules() throws Exception {
final int NUM = 3;
Project.NameKey subKey[] = new NameKey[NUM];
Project.NameKey subKey[] = new Project.NameKey[NUM];
TestRepository<?> sub[] = new TestRepository[NUM];
String prefix = RandomStringUtils.randomAlphabetic(8);
for (int i = 0; i < subKey.length; i++) {

View File

@@ -21,7 +21,7 @@ import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.UseSsh;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.reviewdb.client.Account;
import org.junit.Before;
import org.junit.Test;
@@ -52,7 +52,7 @@ public class SetReviewersIT extends AbstractDaemonTest {
adminSshSession.exec(
String.format("gerrit set-reviewers -%s %s %s", add ? "a" : "r", user.email, id));
adminSshSession.assertSuccess();
ImmutableSet<Id> reviewers = change.getChange().getReviewers().all();
ImmutableSet<Account.Id> reviewers = change.getChange().getReviewers().all();
if (add) {
assertThat(reviewers).contains(user.id);
} else {

View File

@@ -21,7 +21,6 @@ import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.LabelId;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSet.Id;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.testing.GerritBaseTests;
import java.sql.Date;
@@ -103,7 +102,8 @@ public class LabelFunctionTest extends GerritBaseTests {
return new PatchSetApproval(key, (short) value, Date.from(Instant.now()));
}
private static PatchSetApproval.Key makeKey(Id psId, Account.Id accountId, LabelId labelId) {
private static PatchSetApproval.Key makeKey(
PatchSet.Id psId, Account.Id accountId, LabelId labelId) {
return new PatchSetApproval.Key(psId, accountId, labelId);
}

View File

@@ -20,7 +20,7 @@ import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.extensions.annotations.Exports;
import com.google.gerrit.extensions.config.CapabilityDefinition;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.permissions.PermissionBackend;
import com.google.gerrit.server.restapi.config.ListCapabilities;
@@ -88,7 +88,7 @@ public class ListCapabilitiesTest extends GerritBaseTests {
}
@Override
public WithUser absentUser(Id id) {
public WithUser absentUser(Account.Id id) {
throw new UnsupportedOperationException();
}

View File

@@ -71,7 +71,6 @@ import com.google.gerrit.index.IndexConfig;
import com.google.gerrit.index.Schema;
import com.google.gerrit.lifecycle.LifecycleManager;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Patch;
@@ -2424,7 +2423,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
return this;
}
DashboardChangeState draftAndDeleteCommentBy(Id commenterId) {
DashboardChangeState draftAndDeleteCommentBy(Account.Id commenterId) {
deleteDraftCommentBy.add(commenterId);
return this;
}