Prefer subtypes of Multimap

Guava team recommends using the subinterfaces of Multimap, for the
same reasons they recommend using Set and List rather than Collection:
it documents expectations about ordering, uniqueness, and behavior of
equals. Do this across the board in Gerrit.

Mostly this is straightforward and I tried to exactly match existing
behavior where possible. However, there were a few wrinkles, where
different callers passed different subtypes to the same method.

The main one is arguments to ParameterParser#parse and
splitQueryString, where some callers used SetMultimaps (perhaps
semi-intentionally, or perhaps misunderstanding the nature of
HashMultimap). For the purposes of parameter parsing, a ListMultimap
makes more sense, because it preserves argument order and repetition.

Another instance is a couple places in ReceiveCommits and downstream
where there were SetMultimap<?, Ref>. Since Refs do not implement
equals, this is effectively the same thing as a ListMultimap, and
changing the interface no longer misleads readers into thinking there
might be some deduplication happening.

Finally, this change includes a breaking API change to the return
type of ExternalIncludedIn#getIncludedIn.

Change-Id: I5f1d15e27a32e534a6aaefe204e7a31815f4c8d7
This commit is contained in:
Dave Borowitz 2017-01-13 16:26:45 -05:00 committed by David Pursehouse
parent e5c5953205
commit 484da493b3
76 changed files with 367 additions and 355 deletions

View File

@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.UserScopedEventListener;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.registration.RegistrationHandle;
@ -39,7 +39,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
public class EventRecorder {
private final RegistrationHandle eventListenerRegistration;
private final Multimap<String, RefEvent> recordedEvents;
private final ListMultimap<String, RefEvent> recordedEvents;
@Singleton
public static class Factory {

View File

@ -14,7 +14,7 @@
package com.google.gerrit.extensions.config;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.annotations.ExtensionPoint;
import java.util.Collection;
@ -37,6 +37,6 @@ public interface ExternalIncludedIn {
* @param branches the branches that include the commit
* @return additional entries for IncludedInInfo
*/
Multimap<String, String> getIncludedIn(String project, String commit,
ListMultimap<String, String> getIncludedIn(String project, String commit,
Collection<String> tags, Collection<String> branches);
}

View File

@ -14,7 +14,7 @@
package com.google.gerrit.extensions.restapi;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
/**
* Optional interface for {@link RestCollection}.
@ -28,5 +28,5 @@ public interface NeedsParams {
*
* @param params the request parameter
*/
void setParams(Multimap<String, String> params) throws RestApiException;
void setParams(ListMultimap<String, String> params) throws RestApiException;
}

View File

@ -17,7 +17,7 @@ package com.google.gerrit.httpd.plugins;
import static com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnnotation;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.annotations.Export;
import com.google.gerrit.server.plugins.InvalidPluginException;
import com.google.gerrit.server.plugins.ModuleGenerator;
@ -35,7 +35,8 @@ import javax.servlet.http.HttpServlet;
class HttpAutoRegisterModuleGenerator extends ServletModule
implements ModuleGenerator {
private final Map<String, Class<HttpServlet>> serve = new HashMap<>();
private final Multimap<TypeLiteral<?>, Class<?>> listeners = LinkedListMultimap.create();
private final ListMultimap<TypeLiteral<?>, Class<?>> listeners =
LinkedListMultimap.create();
@Override
protected void configureServlets() {

View File

@ -23,7 +23,7 @@ import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.BinaryResult;
import com.google.gerrit.extensions.restapi.Url;
@ -59,7 +59,7 @@ class ParameterParser {
}
<T> boolean parse(T param,
Multimap<String, String> in,
ListMultimap<String, String> in,
HttpServletRequest req,
HttpServletResponse res)
throws IOException {
@ -90,8 +90,8 @@ class ParameterParser {
}
static void splitQueryString(String queryString,
Multimap<String, String> config,
Multimap<String, String> params) {
ListMultimap<String, String> config,
ListMultimap<String, String> params) {
if (!Strings.isNullOrEmpty(queryString)) {
for (String kvPair : Splitter.on('&').split(queryString)) {
Iterator<String> i = Splitter.on('=').limit(2).split(kvPair).iterator();

View File

@ -45,13 +45,13 @@ import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.io.BaseEncoding;
import com.google.common.io.CountingOutputStream;
import com.google.common.math.IntMath;
@ -245,8 +245,8 @@ public class RestApiServlet extends HttpServlet {
int status = SC_OK;
long responseBytes = -1;
Object result = null;
Multimap<String, String> params = LinkedHashMultimap.create();
Multimap<String, String> config = LinkedHashMultimap.create();
ListMultimap<String, String> params = ArrayListMultimap.create();
ListMultimap<String, String> config = ArrayListMultimap.create();
Object inputRequestBody = null;
RestResource rsrc = TopLevelResource.INSTANCE;
ViewData viewData = null;
@ -460,9 +460,9 @@ public class RestApiServlet extends HttpServlet {
metric,
System.nanoTime() - startNanos,
TimeUnit.NANOSECONDS);
globals.auditService.dispatch(new ExtendedHttpAuditEvent(globals.webSession.get()
.getSessionId(), globals.currentUser.get(), req,
auditStartTs, params, inputRequestBody, status,
globals.auditService.dispatch(new ExtendedHttpAuditEvent(
globals.webSession.get().getSessionId(), globals.currentUser.get(),
req, auditStartTs, params, inputRequestBody, status,
result, rsrc, viewData == null ? null : viewData.view));
}
}
@ -777,7 +777,7 @@ public class RestApiServlet extends HttpServlet {
public static long replyJson(@Nullable HttpServletRequest req,
HttpServletResponse res,
Multimap<String, String> config,
ListMultimap<String, String> config,
Object result)
throws IOException {
TemporaryBuffer.Heap buf = heap(HEAP_EST_SIZE, Integer.MAX_VALUE);
@ -796,7 +796,7 @@ public class RestApiServlet extends HttpServlet {
.setCharacterEncoding(UTF_8));
}
private static Gson newGson(Multimap<String, String> config,
private static Gson newGson(ListMultimap<String, String> config,
@Nullable HttpServletRequest req) {
GsonBuilder gb = OutputFormat.JSON_COMPACT.newGsonBuilder();
@ -807,7 +807,7 @@ public class RestApiServlet extends HttpServlet {
}
private static void enablePrettyPrint(GsonBuilder gb,
Multimap<String, String> config,
ListMultimap<String, String> config,
@Nullable HttpServletRequest req) {
String pp = Iterables.getFirst(config.get("pp"), null);
if (pp == null) {
@ -822,7 +822,7 @@ public class RestApiServlet extends HttpServlet {
}
private static void enablePartialGetFields(GsonBuilder gb,
Multimap<String, String> config) {
ListMultimap<String, String> config) {
final Set<String> want = new HashSet<>();
for (String p : config.get("fields")) {
Iterables.addAll(want, OptionUtil.splitOptionValue(p));
@ -1130,7 +1130,8 @@ public class RestApiServlet extends HttpServlet {
static long replyText(@Nullable HttpServletRequest req,
HttpServletResponse res, String text) throws IOException {
if ((req == null || isRead(req)) && isMaybeHTML(text)) {
return replyJson(req, res, ImmutableMultimap.of("pp", "0"), new JsonPrimitive(text));
return replyJson(req, res, ImmutableListMultimap.of("pp", "0"),
new JsonPrimitive(text));
}
if (!text.endsWith("\n")) {
text += "\n";

View File

@ -15,7 +15,7 @@
package com.google.gerrit.httpd.rpc;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.audit.AuditService;
import com.google.gerrit.audit.RpcAuditEvent;
import com.google.gerrit.common.TimeUtil;
@ -133,25 +133,28 @@ final class GerritJsonServlet extends JsonServlet<GerritJsonServlet.GerritCall>
}
Audit note = method.getAnnotation(Audit.class);
if (note != null) {
final String sid = call.getWebSession().getSessionId();
final CurrentUser username = call.getWebSession().getUser();
final Multimap<String, ?> args =
extractParams(note, call);
final String what = extractWhat(note, call);
final Object result = call.getResult();
String sid = call.getWebSession().getSessionId();
CurrentUser username = call.getWebSession().getUser();
ListMultimap<String, ?> args = extractParams(note, call);
String what = extractWhat(note, call);
Object result = call.getResult();
audit.dispatch(new RpcAuditEvent(sid, username, what, call.getWhen(),
args, call.getHttpServletRequest().getMethod(), call.getHttpServletRequest().getMethod(),
((AuditedHttpServletResponse) (call.getHttpServletResponse()))
.getStatus(), result));
audit.dispatch(
new RpcAuditEvent(
sid, username, what, call.getWhen(), args,
call.getHttpServletRequest().getMethod(),
call.getHttpServletRequest().getMethod(),
((AuditedHttpServletResponse) (call.getHttpServletResponse()))
.getStatus(),
result));
}
} catch (Throwable all) {
log.error("Unable to log the call", all);
}
}
private Multimap<String, ?> extractParams(final Audit note, final GerritCall call) {
Multimap<String, Object> args = ArrayListMultimap.create();
private ListMultimap<String, ?> extractParams(Audit note, GerritCall call) {
ListMultimap<String, Object> args = ArrayListMultimap.create();
Object[] params = call.getParams();
for (int i = 0; i < params.length; i++) {

View File

@ -15,8 +15,7 @@
package com.google.gerrit.httpd.rpc.doc;
import com.google.common.base.Strings;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.gerrit.httpd.restapi.RestApiServlet;
import com.google.gerrit.server.documentation.QueryDocumentationExecutor;
import com.google.gerrit.server.documentation.QueryDocumentationExecutor.DocQueryException;
@ -68,8 +67,7 @@ public class QueryDocumentationFilter implements Filter {
HttpServletResponse rsp = (HttpServletResponse) response;
try {
List<DocResult> result = searcher.doQuery(request.getParameter("q"));
Multimap<String, String> config = LinkedHashMultimap.create();
RestApiServlet.replyJson(req, rsp, config, result);
RestApiServlet.replyJson(req, rsp, ImmutableListMultimap.of(), result);
} catch (DocQueryException e) {
log.error("Doc search failed:", e);
rsp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

View File

@ -28,7 +28,7 @@ import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Collections2;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListeningExecutorService;
@ -408,9 +408,9 @@ public class LuceneChangeIndex implements ChangeIndex {
}
}
private static Multimap<String, IndexableField> fields(Document doc,
private static ListMultimap<String, IndexableField> fields(Document doc,
Set<String> fields) {
Multimap<String, IndexableField> stored =
ListMultimap<String, IndexableField> stored =
ArrayListMultimap.create(fields.size(), 4);
for (IndexableField f : doc) {
String name = f.name();
@ -421,7 +421,7 @@ public class LuceneChangeIndex implements ChangeIndex {
return stored;
}
private ChangeData toChangeData(Multimap<String, IndexableField> doc,
private ChangeData toChangeData(ListMultimap<String, IndexableField> doc,
Set<String> fields, String idFieldName) {
ChangeData cd;
// Either change or the ID field was guaranteed to be included in the call
@ -482,7 +482,8 @@ public class LuceneChangeIndex implements ChangeIndex {
return cd;
}
private void decodePatchSets(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodePatchSets(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
List<PatchSet> patchSets =
decodeProtos(doc, PATCH_SET_FIELD, PatchSetProtoField.CODEC);
if (!patchSets.isEmpty()) {
@ -492,12 +493,14 @@ public class LuceneChangeIndex implements ChangeIndex {
}
}
private void decodeApprovals(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodeApprovals(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
cd.setCurrentApprovals(
decodeProtos(doc, APPROVAL_FIELD, PatchSetApprovalProtoField.CODEC));
}
private void decodeChangedLines(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodeChangedLines(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
IndexableField added = Iterables.getFirst(doc.get(ADDED_FIELD), null);
IndexableField deleted = Iterables.getFirst(doc.get(DELETED_FIELD), null);
if (added != null && deleted != null) {
@ -513,7 +516,8 @@ public class LuceneChangeIndex implements ChangeIndex {
}
}
private void decodeMergeable(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodeMergeable(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
IndexableField f = Iterables.getFirst(doc.get(MERGEABLE_FIELD), null);
if (f != null) {
String mergeable = f.stringValue();
@ -525,7 +529,8 @@ public class LuceneChangeIndex implements ChangeIndex {
}
}
private void decodeReviewedBy(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodeReviewedBy(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
Collection<IndexableField> reviewedBy = doc.get(REVIEWEDBY_FIELD);
if (reviewedBy.size() > 0) {
Set<Account.Id> accounts =
@ -541,7 +546,8 @@ public class LuceneChangeIndex implements ChangeIndex {
}
}
private void decodeHashtags(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodeHashtags(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
Collection<IndexableField> hashtag = doc.get(HASHTAG_FIELD);
Set<String> hashtags = Sets.newHashSetWithExpectedSize(hashtag.size());
for (IndexableField r : hashtag) {
@ -550,9 +556,10 @@ public class LuceneChangeIndex implements ChangeIndex {
cd.setHashtags(hashtags);
}
private void decodeStar(Multimap<String, IndexableField> doc, ChangeData cd) {
private void decodeStar(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
Collection<IndexableField> star = doc.get(STAR_FIELD);
Multimap<Account.Id, String> stars = ArrayListMultimap.create();
ListMultimap<Account.Id, String> stars = ArrayListMultimap.create();
for (IndexableField r : star) {
StarredChangesUtil.StarField starField =
StarredChangesUtil.StarField.parse(r.stringValue());
@ -563,7 +570,7 @@ public class LuceneChangeIndex implements ChangeIndex {
cd.setStars(stars);
}
private void decodeReviewers(Multimap<String, IndexableField> doc,
private void decodeReviewers(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
cd.setReviewers(
ChangeField.parseReviewerFieldValues(
@ -571,7 +578,7 @@ public class LuceneChangeIndex implements ChangeIndex {
.transform(IndexableField::stringValue)));
}
private void decodeSubmitRecords(Multimap<String, IndexableField> doc,
private void decodeSubmitRecords(ListMultimap<String, IndexableField> doc,
String field, SubmitRuleOptions opts, ChangeData cd) {
ChangeField.parseSubmitRecords(
Collections2.transform(
@ -579,17 +586,18 @@ public class LuceneChangeIndex implements ChangeIndex {
opts, cd);
}
private void decodeRefStates(Multimap<String, IndexableField> doc,
private void decodeRefStates(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
cd.setRefStates(copyAsBytes(doc.get(REF_STATE_FIELD)));
}
private void decodeRefStatePatterns(Multimap<String, IndexableField> doc,
private void decodeRefStatePatterns(ListMultimap<String, IndexableField> doc,
ChangeData cd) {
cd.setRefStatePatterns(copyAsBytes(doc.get(REF_STATE_PATTERN_FIELD)));
}
private static <T> List<T> decodeProtos(Multimap<String, IndexableField> doc,
private static <T> List<T> decodeProtos(
ListMultimap<String, IndexableField> doc,
String fieldName, ProtobufCodec<T> codec) {
Collection<IndexableField> fields = doc.get(fieldName);
if (fields.isEmpty()) {

View File

@ -21,9 +21,9 @@ import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_U
import com.google.common.base.Predicates;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Ordering;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@ -153,7 +153,7 @@ public class RebuildNoteDb extends SiteProgram {
ListeningExecutorService executor = newExecutor();
System.out.println("Rebuilding the NoteDb");
final ImmutableMultimap<Project.NameKey, Change.Id> changesByProject =
ImmutableListMultimap<Project.NameKey, Change.Id> changesByProject =
getChangesByProject();
boolean ok;
Stopwatch sw = Stopwatch.createStarted();
@ -241,11 +241,11 @@ public class RebuildNoteDb extends SiteProgram {
return MoreExecutors.newDirectExecutorService();
}
private ImmutableMultimap<Project.NameKey, Change.Id> getChangesByProject()
private ImmutableListMultimap<Project.NameKey, Change.Id> getChangesByProject()
throws OrmException {
// Memorize all changes so we can close the db connection and allow
// rebuilder threads to use the full connection pool.
Multimap<Project.NameKey, Change.Id> changesByProject =
ListMultimap<Project.NameKey, Change.Id> changesByProject =
ArrayListMultimap.create();
try (ReviewDb db = schemaFactory.open()) {
if (projects.isEmpty() && !changes.isEmpty()) {
@ -270,12 +270,12 @@ public class RebuildNoteDb extends SiteProgram {
}
}
}
return ImmutableMultimap.copyOf(changesByProject);
return ImmutableListMultimap.copyOf(changesByProject);
}
}
private boolean rebuildProject(ReviewDb db,
ImmutableMultimap<Project.NameKey, Change.Id> allChanges,
ImmutableListMultimap<Project.NameKey, Change.Id> allChanges,
Project.NameKey project, Repository allUsersRepo)
throws IOException, OrmException {
checkArgument(allChanges.containsKey(project));

View File

@ -17,22 +17,22 @@ package com.google.gerrit.audit;
import com.google.auto.value.AutoValue;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.server.CurrentUser;
public class AuditEvent {
public static final String UNKNOWN_SESSION_ID = "000000000000000000000000000";
protected static final Multimap<String, ?> EMPTY_PARAMS =
MultimapBuilder.hashKeys().hashSetValues().build();
protected static final ListMultimap<String, ?> EMPTY_PARAMS =
ImmutableListMultimap.of();
public final String sessionId;
public final CurrentUser who;
public final long when;
public final String what;
public final Multimap<String, ?> params;
public final ListMultimap<String, ?> params;
public final Object result;
public final long timeAtStart;
public final long elapsed;
@ -59,7 +59,7 @@ public class AuditEvent {
* @param result result of the event
*/
public AuditEvent(String sessionId, CurrentUser who, String what, long when,
Multimap<String, ?> params, Object result) {
ListMultimap<String, ?> params, Object result) {
Preconditions.checkNotNull(what, "what is a mandatory not null param !");
this.sessionId = MoreObjects.firstNonNull(sessionId, UNKNOWN_SESSION_ID);

View File

@ -15,7 +15,7 @@
package com.google.gerrit.audit;
import com.google.common.base.Preconditions;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.restapi.RestResource;
import com.google.gerrit.extensions.restapi.RestView;
import com.google.gerrit.server.CurrentUser;
@ -45,11 +45,11 @@ public class ExtendedHttpAuditEvent extends HttpAuditEvent {
* @param view view rendering object
*/
public ExtendedHttpAuditEvent(String sessionId, CurrentUser who,
HttpServletRequest httpRequest, long when, Multimap<String, ?> params,
HttpServletRequest httpRequest, long when, ListMultimap<String, ?> params,
Object input, int status, Object result, RestResource resource,
RestView<RestResource> view) {
super(sessionId, who, httpRequest.getRequestURI(), when, params, httpRequest.getMethod(),
input, status, result);
super(sessionId, who, httpRequest.getRequestURI(), when, params,
httpRequest.getMethod(), input, status, result);
this.httpRequest = Preconditions.checkNotNull(httpRequest);
this.resource = resource;
this.view = view;

View File

@ -13,7 +13,7 @@
// limitations under the License.
package com.google.gerrit.audit;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.server.CurrentUser;
public class HttpAuditEvent extends AuditEvent {
@ -34,8 +34,9 @@ public class HttpAuditEvent extends AuditEvent {
* @param status HTTP status
* @param result result of the event
*/
public HttpAuditEvent(String sessionId, CurrentUser who, String what, long when,
Multimap<String, ?> params, String httpMethod, Object input, int status, Object result) {
public HttpAuditEvent(String sessionId, CurrentUser who, String what,
long when, ListMultimap<String, ?> params, String httpMethod,
Object input, int status, Object result) {
super(sessionId, who, what, when, params, result);
this.httpMethod = httpMethod;
this.input = input;

View File

@ -11,9 +11,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.audit;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.server.CurrentUser;
public class RpcAuditEvent extends HttpAuditEvent {
@ -32,8 +33,8 @@ public class RpcAuditEvent extends HttpAuditEvent {
* @param result result of the event
*/
public RpcAuditEvent(String sessionId, CurrentUser who, String what,
long when, Multimap<String, ?> params, String httpMethod, Object input,
int status, Object result) {
long when, ListMultimap<String, ?> params, String httpMethod,
Object input, int status, Object result) {
super(sessionId, who, what, when, params, httpMethod, input, status, result);
}
}

View File

@ -11,15 +11,16 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.audit;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.server.CurrentUser;
public class SshAuditEvent extends AuditEvent {
public SshAuditEvent(String sessionId, CurrentUser who, String what,
long when, Multimap<String, ?> params, Object result) {
long when, ListMultimap<String, ?> params, Object result) {
super(sessionId, who, what, when, params, result);
}
}

View File

@ -11,10 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.rules;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import com.google.gerrit.extensions.registration.DynamicSet;
import java.util.Collection;
@ -24,7 +25,7 @@ import java.util.Collection;
*/
public class PredicateClassLoader extends ClassLoader {
private final Multimap<String, ClassLoader> packageClassLoaderMap =
private final SetMultimap<String, ClassLoader> packageClassLoaderMap =
LinkedHashMultimap.create();
public PredicateClassLoader(

View File

@ -23,8 +23,8 @@ import com.google.auto.value.AutoValue;
import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.primitives.Ints;
@ -314,7 +314,7 @@ public class StarredChangesUtil {
}
}
public ImmutableMultimap<Account.Id, String> byChangeFromIndex(
public ImmutableListMultimap<Account.Id, String> byChangeFromIndex(
Change.Id changeId) throws OrmException {
Set<String> fields = ImmutableSet.of(
ChangeField.ID.getName(),

View File

@ -17,7 +17,7 @@ package com.google.gerrit.server.account;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountExternalId;
@ -76,7 +76,7 @@ public class ExternalIdCacheImpl implements ExternalIdCache {
public void onCreate(Iterable<AccountExternalId> extIds) {
lock.lock();
try {
Multimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
ListMultimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
.arrayListValues().build(extIdsByAccount.get(AllKey.ALL));
for (AccountExternalId extId : extIds) {
n.put(extId.getAccountId(), extId);
@ -93,7 +93,7 @@ public class ExternalIdCacheImpl implements ExternalIdCache {
public void onRemove(Iterable<AccountExternalId> extIds) {
lock.lock();
try {
Multimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
ListMultimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
.arrayListValues().build(extIdsByAccount.get(AllKey.ALL));
for (AccountExternalId extId : extIds) {
n.remove(extId.getAccountId(), extId);
@ -111,7 +111,7 @@ public class ExternalIdCacheImpl implements ExternalIdCache {
Iterable<AccountExternalId.Key> extIdKeys) {
lock.lock();
try {
Multimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
ListMultimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
.arrayListValues().build(extIdsByAccount.get(AllKey.ALL));
for (AccountExternalId extId : byAccount(accountId)) {
for (AccountExternalId.Key extIdKey : extIdKeys) {
@ -133,7 +133,7 @@ public class ExternalIdCacheImpl implements ExternalIdCache {
public void onUpdate(AccountExternalId updatedExtId) {
lock.lock();
try {
Multimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
ListMultimap<Account.Id, AccountExternalId> n = MultimapBuilder.hashKeys()
.arrayListValues().build(extIdsByAccount.get(AllKey.ALL));
for (AccountExternalId extId : byAccount(updatedExtId.getAccountId())) {
if (updatedExtId.getKey().equals(extId.getKey())) {
@ -181,7 +181,7 @@ public class ExternalIdCacheImpl implements ExternalIdCache {
public ImmutableSetMultimap<Account.Id, AccountExternalId> load(AllKey key)
throws Exception {
try (ReviewDb db = schema.open()) {
Multimap<Account.Id, AccountExternalId> extIdsByAccount =
ListMultimap<Account.Id, AccountExternalId> extIdsByAccount =
MultimapBuilder.hashKeys().arrayListValues().build();
for (AccountExternalId extId : db.accountExternalIds().all()) {
extIdsByAccount.put(extId.getAccountId(), extId);

View File

@ -18,7 +18,7 @@ import static com.google.gerrit.server.account.GroupBackends.GROUP_REF_NAME_COMP
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
@ -138,7 +138,7 @@ public class UniversalGroupBackend implements GroupBackend {
@Override
public boolean containsAnyOf(Iterable<AccountGroup.UUID> uuids) {
Multimap<GroupMembership, AccountGroup.UUID> lookups =
ListMultimap<GroupMembership, AccountGroup.UUID> lookups =
MultimapBuilder.hashKeys().arrayListValues().build();
for (AccountGroup.UUID uuid : uuids) {
if (uuid == null) {
@ -168,7 +168,7 @@ public class UniversalGroupBackend implements GroupBackend {
@Override
public Set<AccountGroup.UUID> intersection(Iterable<AccountGroup.UUID> uuids) {
Multimap<GroupMembership, AccountGroup.UUID> lookups =
ListMultimap<GroupMembership, AccountGroup.UUID> lookups =
MultimapBuilder.hashKeys().arrayListValues().build();
for (AccountGroup.UUID uuid : uuids) {
if (uuid == null) {

View File

@ -25,7 +25,7 @@ import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
@ -269,7 +269,7 @@ public class WatchConfig extends VersionedMetaData
cfg.unsetSection(PROJECT, projectName);
}
Multimap<String, String> notifyValuesByProject =
ListMultimap<String, String> notifyValuesByProject =
MultimapBuilder.hashKeys().arrayListValues().build();
for (Map.Entry<ProjectWatchKey, Set<NotifyType>> e : projectWatches
.entrySet()) {

View File

@ -15,7 +15,7 @@
package com.google.gerrit.server.change;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.extensions.api.changes.AbandonInput;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
@ -95,7 +95,7 @@ public class Abandon implements RestModifyView<ChangeResource, AbandonInput>,
public Change abandon(ChangeControl control, String msgTxt,
NotifyHandling notifyHandling,
Multimap<RecipientType, Account.Id> accountsToNotify)
ListMultimap<RecipientType, Account.Id> accountsToNotify)
throws RestApiException, UpdateException {
CurrentUser user = control.getUser();
Account account = user.isIdentifiedUser()
@ -125,7 +125,7 @@ public class Abandon implements RestModifyView<ChangeResource, AbandonInput>,
public void batchAbandon(Project.NameKey project, CurrentUser user,
Collection<ChangeControl> controls, String msgTxt,
NotifyHandling notifyHandling,
Multimap<RecipientType, Account.Id> accountsToNotify)
ListMultimap<RecipientType, Account.Id> accountsToNotify)
throws RestApiException, UpdateException {
if (controls.isEmpty()) {
return;

View File

@ -14,8 +14,8 @@
package com.google.gerrit.server.change;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.InternalUser;
import com.google.gerrit.server.config.ChangeCleanupConfig;
@ -78,15 +78,15 @@ public class AbandonUtil {
.enforceVisibility(false)
.query(queryBuilder.parse(query))
.entities();
ImmutableMultimap.Builder<Project.NameKey, ChangeControl> builder =
ImmutableMultimap.builder();
ImmutableListMultimap.Builder<Project.NameKey, ChangeControl> builder =
ImmutableListMultimap.builder();
for (ChangeData cd : changesToAbandon) {
ChangeControl control = cd.changeControl(internalUser);
builder.put(control.getProject().getNameKey(), control);
}
int count = 0;
Multimap<Project.NameKey, ChangeControl> abandons = builder.build();
ListMultimap<Project.NameKey, ChangeControl> abandons = builder.build();
String message = cfg.getAbandonMessage();
for (Project.NameKey project : abandons.keySet()) {
Collection<ChangeControl> changes =

View File

@ -21,7 +21,7 @@ import static java.util.stream.Collectors.toSet;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
@ -114,7 +114,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
private CommitValidators.Policy validatePolicy =
CommitValidators.Policy.GERRIT;
private NotifyHandling notify = NotifyHandling.ALL;
private Multimap<RecipientType, Account.Id> accountsToNotify =
private ListMultimap<RecipientType, Account.Id> accountsToNotify =
ImmutableListMultimap.of();
private Set<Account.Id> reviewers;
private Set<Account.Id> extraCC;
@ -240,7 +240,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
}
public ChangeInserter setAccountsToNotify(
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.accountsToNotify = checkNotNull(accountsToNotify);
return this;
}

View File

@ -50,7 +50,6 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
@ -821,7 +820,7 @@ public class ChangeJson {
}
Set<String> labelNames = new HashSet<>();
Multimap<Account.Id, PatchSetApproval> current =
SetMultimap<Account.Id, PatchSetApproval> current =
MultimapBuilder.hashKeys().hashSetValues().build();
for (PatchSetApproval a : cd.currentApprovals()) {
allUsers.add(a.getAccountId());

View File

@ -23,8 +23,8 @@ import static com.google.gerrit.server.ChangeUtil.PS_ID_ORDER;
import com.google.auto.value.AutoValue;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.TimeUtil;
@ -126,7 +126,7 @@ public class ConsistencyChecker {
private RevWalk rw;
private RevCommit tip;
private Multimap<ObjectId, PatchSet> patchSetsBySha;
private SetMultimap<ObjectId, PatchSet> patchSetsBySha;
private PatchSet currPs;
private RevCommit currPsCommit;

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server.change;
import static com.google.gerrit.server.CommentsUtil.COMMENT_ORDER;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -53,7 +53,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
interface Factory {
EmailReviewComments create(
NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify,
ListMultimap<RecipientType, Account.Id> accountsToNotify,
ChangeNotes notes,
PatchSet patchSet,
IdentifiedUser user,
@ -70,7 +70,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
private final ThreadLocalRequestContext requestContext;
private final NotifyHandling notify;
private final Multimap<RecipientType, Account.Id> accountsToNotify;
private final ListMultimap<RecipientType, Account.Id> accountsToNotify;
private final ChangeNotes notes;
private final PatchSet patchSet;
private final IdentifiedUser user;
@ -88,7 +88,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
SchemaFactory<ReviewDb> schemaFactory,
ThreadLocalRequestContext requestContext,
@Assisted NotifyHandling notify,
@Assisted Multimap<RecipientType, Account.Id> accountsToNotify,
@Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify,
@Assisted ChangeNotes notes,
@Assisted PatchSet patchSet,
@Assisted IdentifiedUser user,

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.change;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.extensions.config.ExternalIncludedIn;
import com.google.gerrit.extensions.registration.DynamicSet;
@ -81,10 +81,10 @@ class IncludedIn implements RestReadView<ChangeResource> {
}
IncludedInResolver.Result d = IncludedInResolver.resolve(r, rw, rev);
Multimap<String, String> external =
ListMultimap<String, String> external =
MultimapBuilder.hashKeys().arrayListValues().build();
for (ExternalIncludedIn ext : includedIn) {
Multimap<String, String> extIncludedIns = ext.getIncludedIn(
ListMultimap<String, String> extIncludedIns = ext.getIncludedIn(
project.get(), rev.name(), d.getTags(), d.getBranches());
if (extIncludedIns != null) {
external.putAll(extIncludedIns);

View File

@ -15,8 +15,8 @@
package com.google.gerrit.server.change;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
@ -76,7 +76,7 @@ public class IncludedInResolver {
private final RevCommit target;
private final RevFlag containsTarget;
private Multimap<RevCommit, String> commitToRef;
private ListMultimap<RevCommit, String> commitToRef;
private List<RevCommit> tipsByCommitTime;
private IncludedInResolver(Repository repo, RevWalk rw, RevCommit target,

View File

@ -18,7 +18,7 @@ import static java.util.stream.Collectors.joining;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.NotifyInfo;
@ -77,14 +77,14 @@ public class NotifyUtil {
return notifyInfo.accounts == null || notifyInfo.accounts.isEmpty();
}
public Multimap<RecipientType, Account.Id> resolveAccounts(
public ListMultimap<RecipientType, Account.Id> resolveAccounts(
@Nullable Map<RecipientType, NotifyInfo> notifyDetails)
throws OrmException, BadRequestException {
if (isNullOrEmpty(notifyDetails)) {
return ImmutableListMultimap.of();
}
Multimap<RecipientType, Account.Id> m = null;
ListMultimap<RecipientType, Account.Id> m = null;
for (Entry<RecipientType, NotifyInfo> e : notifyDetails.entrySet()) {
List<String> accounts = e.getValue().accounts;
if (accounts != null) {

View File

@ -20,7 +20,7 @@ import static com.google.gerrit.server.notedb.ReviewerStateInternal.CC;
import static com.google.gerrit.server.notedb.ReviewerStateInternal.REVIEWER;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
import com.google.gerrit.extensions.restapi.AuthException;
@ -100,7 +100,7 @@ public class PatchSetInserter extends BatchUpdate.Op {
private List<String> groups = Collections.emptyList();
private boolean fireRevisionCreated = true;
private NotifyHandling notify = NotifyHandling.ALL;
private Multimap<RecipientType, Account.Id> accountsToNotify =
private ListMultimap<RecipientType, Account.Id> accountsToNotify =
ImmutableListMultimap.of();
private boolean allowClosed;
private boolean copyApprovals = true;
@ -185,7 +185,7 @@ public class PatchSetInserter extends BatchUpdate.Op {
}
public PatchSetInserter setAccountsToNotify(
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.accountsToNotify = checkNotNull(accountsToNotify);
return this;
}

View File

@ -27,9 +27,9 @@ import com.google.auto.value.AutoValue;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import com.google.common.hash.HashCode;
import com.google.common.hash.Hashing;
@ -207,7 +207,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
input.notify = NotifyHandling.NONE;
}
Multimap<RecipientType, Account.Id> accountsToNotify =
ListMultimap<RecipientType, Account.Id> accountsToNotify =
notifyUtil.resolveAccounts(input.notifyDetails);
Map<String, AddReviewerResult> reviewerJsonResults = null;
@ -304,7 +304,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
private void emailReviewers(Change change,
List<PostReviewers.Addition> reviewerAdditions, NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
List<Account.Id> to = new ArrayList<>();
List<Account.Id> cc = new ArrayList<>();
for (PostReviewers.Addition addition : reviewerAdditions) {
@ -671,7 +671,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
private class Op extends BatchUpdate.Op {
private final PatchSet.Id psId;
private final ReviewInput in;
private final Multimap<RecipientType, Account.Id> accountsToNotify;
private final ListMultimap<RecipientType, Account.Id> accountsToNotify;
private final List<PostReviewers.Addition> reviewerResults;
private IdentifiedUser user;
@ -684,7 +684,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
private Map<String, Short> oldApprovals = new HashMap<>();
private Op(PatchSet.Id psId, ReviewInput in,
Multimap<RecipientType, Account.Id> accountsToNotify,
ListMultimap<RecipientType, Account.Id> accountsToNotify,
List<PostReviewers.Addition> reviewerResults) {
this.psId = psId;
this.in = in;

View File

@ -21,8 +21,8 @@ import static com.google.gerrit.extensions.client.ReviewerState.REVIEWER;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.errors.NoSuchGroupException;
@ -201,7 +201,7 @@ public class PostReviewers
private Addition putAccount(String reviewer, ReviewerResource rsrc,
ReviewerState state, NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify)
ListMultimap<RecipientType, Account.Id> accountsToNotify)
throws UnprocessableEntityException {
Account member = rsrc.getReviewerUser().getAccount();
ChangeControl control = rsrc.getReviewerControl();
@ -303,7 +303,7 @@ public class PostReviewers
protected Addition(String reviewer, ChangeResource rsrc,
Map<Account.Id, ChangeControl> reviewers, ReviewerState state,
NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
result = new AddReviewerResult(reviewer);
if (reviewers == null) {
this.reviewers = ImmutableMap.of();
@ -342,7 +342,7 @@ public class PostReviewers
final Map<Account.Id, ChangeControl> reviewers;
final ReviewerState state;
final NotifyHandling notify;
final Multimap<RecipientType, Account.Id> accountsToNotify;
final ListMultimap<RecipientType, Account.Id> accountsToNotify;
List<PatchSetApproval> addedReviewers;
Collection<Account.Id> addedCCs;
@ -351,7 +351,7 @@ public class PostReviewers
Op(ChangeResource rsrc, Map<Account.Id, ChangeControl> reviewers,
ReviewerState state, NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.rsrc = rsrc;
this.reviewers = reviewers;
this.state = state;
@ -407,7 +407,7 @@ public class PostReviewers
public void emailReviewers(Change change, Collection<Account.Id> added,
Collection<Account.Id> copied, NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
if (added.isEmpty() && copied.isEmpty()) {
return;
}

View File

@ -21,7 +21,7 @@ import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Sets;
import com.google.gerrit.common.data.ParameterizedString;
import com.google.gerrit.extensions.api.changes.SubmitInput;
@ -418,7 +418,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
mergeabilityMap.add(change);
}
Multimap<Branch.NameKey, ChangeData> cbb = cs.changesByBranch();
ListMultimap<Branch.NameKey, ChangeData> cbb = cs.changesByBranch();
for (Branch.NameKey branch : cbb.keySet()) {
Collection<ChangeData> targetBranch = cbb.get(branch);
HashMap<Change.Id, RevCommit> commits =

View File

@ -20,7 +20,7 @@ import com.google.auto.value.AutoValue;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Ordering;
import com.google.gerrit.reviewdb.client.PatchSet;
@ -105,7 +105,7 @@ class WalkSorter {
public Iterable<PatchSetData> sort(Iterable<ChangeData> in)
throws OrmException, IOException {
Multimap<Project.NameKey, ChangeData> byProject =
ListMultimap<Project.NameKey, ChangeData> byProject =
MultimapBuilder.hashKeys().arrayListValues().build();
for (ChangeData cd : in) {
byProject.put(cd.change().getProject(), cd);
@ -126,7 +126,7 @@ class WalkSorter {
try (Repository repo = repoManager.openRepository(project);
RevWalk rw = new RevWalk(repo)) {
rw.setRetainBody(retainBody);
Multimap<RevCommit, PatchSetData> byCommit = byCommit(rw, in);
ListMultimap<RevCommit, PatchSetData> byCommit = byCommit(rw, in);
if (byCommit.isEmpty()) {
return ImmutableList.of();
} else if (byCommit.size() == 1) {
@ -151,8 +151,8 @@ class WalkSorter {
// the input size is small enough that this is not an issue.)
Set<RevCommit> commits = byCommit.keySet();
Multimap<RevCommit, RevCommit> children = collectChildren(commits);
Multimap<RevCommit, RevCommit> pending =
ListMultimap<RevCommit, RevCommit> children = collectChildren(commits);
ListMultimap<RevCommit, RevCommit> pending =
MultimapBuilder.hashKeys().arrayListValues().build();
Deque<RevCommit> todo = new ArrayDeque<>();
@ -195,9 +195,9 @@ class WalkSorter {
}
}
private static Multimap<RevCommit, RevCommit> collectChildren(
private static ListMultimap<RevCommit, RevCommit> collectChildren(
Set<RevCommit> commits) {
Multimap<RevCommit, RevCommit> children =
ListMultimap<RevCommit, RevCommit> children =
MultimapBuilder.hashKeys().arrayListValues().build();
for (RevCommit c : commits) {
for (RevCommit p : c.getParents()) {
@ -209,8 +209,9 @@ class WalkSorter {
return children;
}
private static int emit(RevCommit c, Multimap<RevCommit, PatchSetData> byCommit,
List<PatchSetData> result, RevFlag done) {
private static int emit(RevCommit c,
ListMultimap<RevCommit, PatchSetData> byCommit, List<PatchSetData> result,
RevFlag done) {
if (c.has(done)) {
return 0;
}
@ -223,9 +224,9 @@ class WalkSorter {
return 0;
}
private Multimap<RevCommit, PatchSetData> byCommit(RevWalk rw,
private ListMultimap<RevCommit, PatchSetData> byCommit(RevWalk rw,
Collection<ChangeData> in) throws OrmException, IOException {
Multimap<RevCommit, PatchSetData> byCommit =
ListMultimap<RevCommit, PatchSetData> byCommit =
MultimapBuilder.hashKeys(in.size()).arrayListValues(1).build();
for (ChangeData cd : in) {
PatchSet maxPs = null;

View File

@ -15,7 +15,7 @@
package com.google.gerrit.server.config;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import org.eclipse.jgit.revwalk.FooterLine;
@ -37,8 +37,8 @@ public class TrackingFooters {
return trackingFooters.isEmpty();
}
public Multimap<String, String> extract(List<FooterLine> lines) {
Multimap<String, String> r = ArrayListMultimap.create();
public ListMultimap<String, String> extract(List<FooterLine> lines) {
ListMultimap<String, String> r = ArrayListMultimap.create();
if (lines == null) {
return r;
}

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server.edit;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -171,7 +171,7 @@ public class ChangeEditUtil {
* @throws RestApiException
*/
public void publish(final ChangeEdit edit, NotifyHandling notify,
Multimap<RecipientType, Account.Id> accountsToNotify)
ListMultimap<RecipientType, Account.Id> accountsToNotify)
throws IOException, OrmException, RestApiException, UpdateException {
Change change = edit.getChange();
try (Repository repo = gitManager.openRepository(change.getProject());

View File

@ -17,8 +17,8 @@ package com.google.gerrit.server.events;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Comparator.comparing;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
@ -354,7 +354,8 @@ public class EventFactory {
return d;
}
public void addTrackingIds(ChangeAttribute a, Multimap<String, String> set) {
public void addTrackingIds(ChangeAttribute a,
ListMultimap<String, String> set) {
if (!set.isEmpty()) {
a.trackingIds = new ArrayList<>(set.size());
for (Map.Entry<String, Collection<String>> e : set.asMap().entrySet()) {

View File

@ -15,7 +15,7 @@
package com.google.gerrit.server.git;
import com.google.common.base.Strings;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -49,7 +49,7 @@ public class AbandonOp extends BatchUpdate.Op {
private final String msgTxt;
private final NotifyHandling notifyHandling;
private final Multimap<RecipientType, Account.Id> accountsToNotify;
private final ListMultimap<RecipientType, Account.Id> accountsToNotify;
private final Account account;
private Change change;
@ -61,7 +61,7 @@ public class AbandonOp extends BatchUpdate.Op {
@Assisted @Nullable Account account,
@Assisted @Nullable String msgTxt,
@Assisted NotifyHandling notifyHandling,
@Assisted Multimap<RecipientType, Account.Id> accountsToNotify);
@Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify);
}
@AssistedInject
@ -73,7 +73,7 @@ public class AbandonOp extends BatchUpdate.Op {
@Assisted @Nullable Account account,
@Assisted @Nullable String msgTxt,
@Assisted NotifyHandling notifyHandling,
@Assisted Multimap<RecipientType, Account.Id> accountsToNotify) {
@Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.abandonedSenderFactory = abandonedSenderFactory;
this.cmUtil = cmUtil;
this.psUtil = psUtil;

View File

@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
@ -82,7 +81,7 @@ public class ChangeSet {
return changeData;
}
public Multimap<Branch.NameKey, ChangeData> changesByBranch()
public ListMultimap<Branch.NameKey, ChangeData> changesByBranch()
throws OrmException {
ListMultimap<Branch.NameKey, ChangeData> ret =
MultimapBuilder.hashKeys().arrayListValues().build();

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.git;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -46,7 +46,7 @@ public class EmailMerge implements Runnable, RequestContext {
public interface Factory {
EmailMerge create(Project.NameKey project, Change.Id changeId,
Account.Id submitter, NotifyHandling notifyHandling,
Multimap<RecipientType, Account.Id> accountsToNotify);
ListMultimap<RecipientType, Account.Id> accountsToNotify);
}
private final ExecutorService sendEmailsExecutor;
@ -59,7 +59,7 @@ public class EmailMerge implements Runnable, RequestContext {
private final Change.Id changeId;
private final Account.Id submitter;
private final NotifyHandling notifyHandling;
private final Multimap<RecipientType, Account.Id> accountsToNotify;
private final ListMultimap<RecipientType, Account.Id> accountsToNotify;
private ReviewDb db;
@ -73,7 +73,7 @@ public class EmailMerge implements Runnable, RequestContext {
@Assisted Change.Id changeId,
@Assisted @Nullable Account.Id submitter,
@Assisted NotifyHandling notifyHandling,
@Assisted Multimap<RecipientType, Account.Id> accountsToNotify) {
@Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.sendEmailsExecutor = executor;
this.mergedSenderFactory = mergedSenderFactory;
this.schemaFactory = schemaFactory;

View File

@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;
@ -103,16 +102,16 @@ public class GroupCollector {
List<String> lookup(PatchSet.Id psId) throws OrmException;
}
private final Multimap<ObjectId, PatchSet.Id> patchSetsBySha;
private final Multimap<ObjectId, String> groups;
private final ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha;
private final ListMultimap<ObjectId, String> groups;
private final SetMultimap<String, String> groupAliases;
private final Lookup groupLookup;
private boolean done;
public static GroupCollector create(Multimap<ObjectId, Ref> changeRefsById,
final ReviewDb db, final PatchSetUtil psUtil,
final ChangeNotes.Factory notesFactory, final Project.NameKey project) {
public static GroupCollector create(ListMultimap<ObjectId, Ref> changeRefsById,
ReviewDb db, PatchSetUtil psUtil, ChangeNotes.Factory notesFactory,
Project.NameKey project) {
return new GroupCollector(
transformRefs(changeRefsById),
new Lookup() {
@ -128,7 +127,7 @@ public class GroupCollector {
}
public static GroupCollector createForSchemaUpgradeOnly(
Multimap<ObjectId, Ref> changeRefsById, final ReviewDb db) {
ListMultimap<ObjectId, Ref> changeRefsById, ReviewDb db) {
return new GroupCollector(
transformRefs(changeRefsById),
new Lookup() {
@ -141,7 +140,7 @@ public class GroupCollector {
}
private GroupCollector(
Multimap<ObjectId, PatchSet.Id> patchSetsBySha,
ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha,
Lookup groupLookup) {
this.patchSetsBySha = patchSetsBySha;
this.groupLookup = groupLookup;
@ -149,16 +148,16 @@ public class GroupCollector {
groupAliases = MultimapBuilder.hashKeys().hashSetValues().build();
}
private static Multimap<ObjectId, PatchSet.Id> transformRefs(
Multimap<ObjectId, Ref> refs) {
private static ListMultimap<ObjectId, PatchSet.Id> transformRefs(
ListMultimap<ObjectId, Ref> refs) {
return Multimaps.transformValues(
refs, r -> PatchSet.Id.fromRef(r.getName()));
}
@VisibleForTesting
GroupCollector(
Multimap<ObjectId, PatchSet.Id> patchSetsBySha,
final ListMultimap<PatchSet.Id, String> groupLookup) {
ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha,
ListMultimap<PatchSet.Id, String> groupLookup) {
this(
patchSetsBySha,
new Lookup() {

View File

@ -21,12 +21,13 @@ import static java.util.Comparator.comparing;
import com.google.auto.value.AutoValue;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.TimeUtil;
@ -109,7 +110,7 @@ public class MergeOp implements AutoCloseable {
private final ImmutableMap<Change.Id, ChangeData> changes;
private final ImmutableSetMultimap<Branch.NameKey, Change.Id> byBranch;
private final Map<Change.Id, CodeReviewCommit> commits;
private final Multimap<Change.Id, String> problems;
private final ListMultimap<Change.Id, String> problems;
private CommitStatus(ChangeSet cs) throws OrmException {
checkArgument(!cs.furtherHiddenChanges(),
@ -163,8 +164,8 @@ public class MergeOp implements AutoCloseable {
return problems.isEmpty();
}
public ImmutableMultimap<Change.Id, String> getProblems() {
return ImmutableMultimap.copyOf(problems);
public ImmutableListMultimap<Change.Id, String> getProblems() {
return ImmutableListMultimap.copyOf(problems);
}
public List<SubmitRecord> getSubmitRecords(Change.Id id) {
@ -228,7 +229,7 @@ public class MergeOp implements AutoCloseable {
private CommitStatus commits;
private ReviewDb db;
private SubmitInput submitInput;
private Multimap<RecipientType, Account.Id> accountsToNotify;
private ListMultimap<RecipientType, Account.Id> accountsToNotify;
private Set<Project.NameKey> allProjects;
private boolean dryrun;
@ -452,7 +453,7 @@ public class MergeOp implements AutoCloseable {
logDebug("Beginning merge attempt on {}", cs);
Map<Branch.NameKey, BranchBatch> toSubmit = new HashMap<>();
Multimap<Branch.NameKey, ChangeData> cbb;
ListMultimap<Branch.NameKey, ChangeData> cbb;
try {
cbb = cs.changesByBranch();
} catch (OrmException e) {
@ -596,7 +597,7 @@ public class MergeOp implements AutoCloseable {
Collection<ChangeData> submitted) throws IntegrationException {
logDebug("Validating {} changes", submitted.size());
List<ChangeData> toSubmit = new ArrayList<>(submitted.size());
Multimap<ObjectId, PatchSet.Id> revisions = getRevisions(or, submitted);
SetMultimap<ObjectId, PatchSet.Id> revisions = getRevisions(or, submitted);
SubmitType submitType = null;
ChangeData choseSubmitTypeFrom = null;
@ -696,7 +697,7 @@ public class MergeOp implements AutoCloseable {
return new AutoValue_MergeOp_BranchBatch(submitType, toSubmit);
}
private Multimap<ObjectId, PatchSet.Id> getRevisions(OpenRepo or,
private SetMultimap<ObjectId, PatchSet.Id> getRevisions(OpenRepo or,
Collection<ChangeData> cds) throws IntegrationException {
try {
List<String> refNames = new ArrayList<>(cds.size());
@ -706,7 +707,7 @@ public class MergeOp implements AutoCloseable {
refNames.add(c.currentPatchSetId().toRefName());
}
}
Multimap<ObjectId, PatchSet.Id> revisions =
SetMultimap<ObjectId, PatchSet.Id> revisions =
MultimapBuilder.hashKeys(cds.size()).hashSetValues(1).build();
for (Map.Entry<String, Ref> e : or.repo.getRefDatabase().exactRef(
refNames.toArray(new String[refNames.size()])).entrySet()) {

View File

@ -44,9 +44,7 @@ import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import com.google.common.collect.SortedSetMultimap;
import com.google.gerrit.common.Nullable;
@ -325,7 +323,7 @@ public class ReceiveCommits {
private final Set<ObjectId> validCommits = new HashSet<>();
private ListMultimap<Change.Id, Ref> refsByChange;
private SetMultimap<ObjectId, Ref> refsById;
private ListMultimap<ObjectId, Ref> refsById;
private Map<String, Ref> allRefs;
private final SubmoduleOp.Factory subOpFactory;
@ -1325,8 +1323,8 @@ public class ReceiveCommits {
return new MailRecipients(reviewer, cc);
}
Multimap<RecipientType, Account.Id> getAccountsToNotify() {
Multimap<RecipientType, Account.Id> accountsToNotify =
ListMultimap<RecipientType, Account.Id> getAccountsToNotify() {
ListMultimap<RecipientType, Account.Id> accountsToNotify =
MultimapBuilder.hashKeys().arrayListValues().build();
accountsToNotify.putAll(RecipientType.TO, tos);
accountsToNotify.putAll(RecipientType.CC, ccs);
@ -1673,8 +1671,9 @@ public class ReceiveCommits {
logDebug("Finding new and replaced changes");
newChanges = new ArrayList<>();
SetMultimap<ObjectId, Ref> existing = changeRefsById();
GroupCollector groupCollector = GroupCollector.create(changeRefsById(), db, psUtil,
ListMultimap<ObjectId, Ref> existing = changeRefsById();
GroupCollector groupCollector = GroupCollector.create(
changeRefsById(), db, psUtil,
notesFactory, project.getNameKey());
try {
@ -2527,7 +2526,7 @@ public class ReceiveCommits {
private void initChangeRefMaps() {
if (refsByChange == null) {
int estRefsPerChange = 4;
refsById = MultimapBuilder.hashKeys().hashSetValues().build();
refsById = MultimapBuilder.hashKeys().arrayListValues().build();
refsByChange =
MultimapBuilder.hashKeys(allRefs.size() / estRefsPerChange)
.arrayListValues(estRefsPerChange)
@ -2550,7 +2549,7 @@ public class ReceiveCommits {
return refsByChange;
}
private SetMultimap<ObjectId, Ref> changeRefsById() {
private ListMultimap<ObjectId, Ref> changeRefsById() {
initChangeRefMaps();
return refsById;
}
@ -2630,7 +2629,7 @@ public class ReceiveCommits {
if (!(parsedObject instanceof RevCommit)) {
return;
}
SetMultimap<ObjectId, Ref> existing = changeRefsById();
ListMultimap<ObjectId, Ref> existing = changeRefsById();
walk.markStart((RevCommit)parsedObject);
markHeadsAsUninteresting(walk, cmd.getRefName());
int i = 0;
@ -2727,7 +2726,7 @@ public class ReceiveCommits {
rw.markUninteresting(rw.parseCommit(cmd.getOldId()));
}
SetMultimap<ObjectId, Ref> byCommit = changeRefsById();
ListMultimap<ObjectId, Ref> byCommit = changeRefsById();
Map<Change.Key, ChangeNotes> byKey = null;
List<ReplaceRequest> replaceAndClose = new ArrayList<>();

View File

@ -15,7 +15,6 @@
package com.google.gerrit.server.git;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.gerrit.common.data.SubscribeSection;
@ -115,7 +114,7 @@ public class SubmoduleOp {
// sorted version of affectedBranches
private final ImmutableSet<Branch.NameKey> sortedBranches;
// map of superproject branch and its submodule subscriptions
private final Multimap<Branch.NameKey, SubmoduleSubscription> targets;
private final SetMultimap<Branch.NameKey, SubmoduleSubscription> targets;
// map of superproject and its branches which has submodule subscriptions
private final SetMultimap<Project.NameKey, Branch.NameKey> branchesByProject;

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server.git.strategy;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Sets;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -99,7 +99,7 @@ public abstract class SubmitStrategy {
Set<RevCommit> alreadyAccepted,
RequestId submissionId,
NotifyHandling notifyHandling,
Multimap<RecipientType, Account.Id> accountsToNotify,
ListMultimap<RecipientType, Account.Id> accountsToNotify,
SubmoduleOp submoduleOp,
boolean dryrun);
}
@ -133,7 +133,7 @@ public abstract class SubmitStrategy {
final RequestId submissionId;
final SubmitType submitType;
final NotifyHandling notifyHandling;
final Multimap<RecipientType, Account.Id> accountsToNotify;
final ListMultimap<RecipientType, Account.Id> accountsToNotify;
final SubmoduleOp submoduleOp;
final ProjectState project;
@ -172,7 +172,7 @@ public abstract class SubmitStrategy {
@Assisted RequestId submissionId,
@Assisted SubmitType submitType,
@Assisted NotifyHandling notifyHandling,
@Assisted Multimap<RecipientType, Account.Id> accountsToNotify,
@Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify,
@Assisted SubmoduleOp submoduleOp,
@Assisted boolean dryrun) {
this.accountCache = accountCache;

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.git.strategy;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
import com.google.gerrit.extensions.client.SubmitType;
@ -59,7 +59,7 @@ public class SubmitStrategyFactory {
Branch.NameKey destBranch, IdentifiedUser caller, MergeTip mergeTip,
CommitStatus commits, RequestId submissionId,
NotifyHandling notifyHandling,
Multimap<RecipientType, Account.Id> accountsToNotify,
ListMultimap<RecipientType, Account.Id> accountsToNotify,
SubmoduleOp submoduleOp, boolean dryrun) throws IntegrationException {
SubmitStrategy.Arguments args = argsFactory.create(submitType, destBranch,
commits, rw, caller, mergeTip, inserter, repo, canMergeFlag, db,

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.group;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.data.GroupDescriptions;
import com.google.gerrit.common.data.GroupReference;
@ -70,7 +70,7 @@ public class GroupsCollection implements
}
@Override
public void setParams(Multimap<String, String> params)
public void setParams(ListMultimap<String, String> params)
throws BadRequestException {
if (params.containsKey("query") && params.containsKey("query2")) {
throw new BadRequestException(

View File

@ -23,8 +23,8 @@ import static org.eclipse.jgit.lib.RefDatabase.ALL;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
@ -217,7 +217,7 @@ public class AllChangesIndexer
return new Callable<Void>() {
@Override
public Void call() throws Exception {
Multimap<ObjectId, ChangeData> byId =
ListMultimap<ObjectId, ChangeData> byId =
MultimapBuilder.hashKeys().arrayListValues().build();
// TODO(dborowitz): Opening all repositories in a live server may be
// wasteful; see if we can determine which ones it is safe to close
@ -260,7 +260,7 @@ public class AllChangesIndexer
private final ChangeIndexer indexer;
private final ThreeWayMergeStrategy mergeStrategy;
private final AutoMerger autoMerger;
private final Multimap<ObjectId, ChangeData> byId;
private final ListMultimap<ObjectId, ChangeData> byId;
private final ProgressMonitor done;
private final ProgressMonitor failed;
private final PrintWriter verboseWriter;
@ -269,7 +269,7 @@ public class AllChangesIndexer
private ProjectIndexer(ChangeIndexer indexer,
ThreeWayMergeStrategy mergeStrategy,
AutoMerger autoMerger,
Multimap<ObjectId, ChangeData> changesByCommitId,
ListMultimap<ObjectId, ChangeData> changesByCommitId,
Repository repo,
ProgressMonitor done,
ProgressMonitor failed,

View File

@ -24,7 +24,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
@ -110,7 +109,7 @@ public class StalenessChecker {
Change indexChange,
@Nullable Change reviewDbChange,
SetMultimap<Project.NameKey, RefState> states,
Multimap<Project.NameKey, RefStatePattern> patterns) {
ListMultimap<Project.NameKey, RefStatePattern> patterns) {
return reviewDbChangeIsStale(indexChange, reviewDbChange)
|| refsAreStale(repoManager, id, states, patterns);
}
@ -119,7 +118,7 @@ public class StalenessChecker {
static boolean refsAreStale(GitRepositoryManager repoManager,
Change.Id id,
SetMultimap<Project.NameKey, RefState> states,
Multimap<Project.NameKey, RefStatePattern> patterns) {
ListMultimap<Project.NameKey, RefStatePattern> patterns) {
Set<Project.NameKey> projects =
Sets.union(states.keySet(), patterns.keySet());
@ -172,7 +171,7 @@ public class StalenessChecker {
return result;
}
private Multimap<Project.NameKey, RefStatePattern> parsePatterns(
private ListMultimap<Project.NameKey, RefStatePattern> parsePatterns(
ChangeData cd) {
return parsePatterns(cd.getRefStatePatterns());
}
@ -197,7 +196,7 @@ public class StalenessChecker {
private static boolean refsAreStale(GitRepositoryManager repoManager,
Change.Id id, Project.NameKey project,
SetMultimap<Project.NameKey, RefState> allStates,
Multimap<Project.NameKey, RefStatePattern> allPatterns) {
ListMultimap<Project.NameKey, RefStatePattern> allPatterns) {
try (Repository repo = repoManager.openRepository(project)) {
Set<RefState> states = allStates.get(project);
for (RefState state : states) {

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.mail.send;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.errors.EmailException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -310,7 +310,7 @@ public abstract class ChangeEmail extends NotificationEmail {
// BCC anyone who has starred this change
// and remove anyone who has ignored this change.
//
Multimap<Account.Id, String> stars =
ListMultimap<Account.Id, String> stars =
args.starredChangesUtil.byChangeFromIndex(change.getId());
for (Map.Entry<Account.Id, Collection<String>> e :
stars.asMap().entrySet()) {

View File

@ -20,7 +20,7 @@ import static com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailSt
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.errors.EmailException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
@ -76,7 +76,7 @@ public abstract class OutgoingEmail {
private Address smtpFromAddress;
private StringBuilder textBody;
private StringBuilder htmlBody;
private Multimap<RecipientType, Account.Id> accountsToNotify =
private ListMultimap<RecipientType, Account.Id> accountsToNotify =
ImmutableListMultimap.of();
protected VelocityContext velocityContext;
protected Map<String, Object> soyContext;
@ -101,7 +101,7 @@ public abstract class OutgoingEmail {
}
public void setAccountsToNotify(
Multimap<RecipientType, Account.Id> accountsToNotify) {
ListMultimap<RecipientType, Account.Id> accountsToNotify) {
this.accountsToNotify = checkNotNull(accountsToNotify);
}

View File

@ -37,9 +37,9 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
@ -562,7 +562,7 @@ public class ChangeBundle {
// but easy to reason about.
List<ChangeMessage> as = new LinkedList<>(bundleA.filterChangeMessages());
Multimap<ChangeMessageCandidate, ChangeMessage> bs =
ListMultimap<ChangeMessageCandidate, ChangeMessage> bs =
LinkedListMultimap.create();
for (ChangeMessage b : bundleB.filterChangeMessages()) {
bs.put(ChangeMessageCandidate.create(b), b);

View File

@ -21,7 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.primitives.Ints;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
@ -525,7 +525,7 @@ public class ChangeNoteUtil {
* side.
* @param out output stream to write to.
*/
void buildNote(Multimap<Integer, Comment> comments,
void buildNote(ListMultimap<Integer, Comment> comments,
OutputStream out) {
if (comments.isEmpty()) {
return;

View File

@ -40,8 +40,8 @@ import com.google.common.base.Splitter;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;
@ -130,7 +130,7 @@ class ChangeNotesParser {
private final List<Account.Id> allPastReviewers;
private final List<ReviewerStatusUpdate> reviewerUpdates;
private final List<SubmitRecord> submitRecords;
private final Multimap<RevId, Comment> comments;
private final ListMultimap<RevId, Comment> comments;
private final Map<PatchSet.Id, PatchSet> patchSets;
private final Set<PatchSet.Id> deletedPatchSets;
private final Map<PatchSet.Id, PatchSetState> patchSetStates;
@ -138,7 +138,8 @@ class ChangeNotesParser {
private final Map<ApprovalKey, PatchSetApproval> approvals;
private final List<PatchSetApproval> bufferedApprovals;
private final List<ChangeMessage> allChangeMessages;
private final Multimap<PatchSet.Id, ChangeMessage> changeMessagesByPatchSet;
private final ListMultimap<PatchSet.Id, ChangeMessage>
changeMessagesByPatchSet;
// Non-final private members filled in during the parsing process.
private String branch;
@ -248,8 +249,8 @@ class ChangeNotesParser {
return null;
}
private Multimap<PatchSet.Id, PatchSetApproval> buildApprovals() {
Multimap<PatchSet.Id, PatchSetApproval> result =
private ListMultimap<PatchSet.Id, PatchSetApproval> buildApprovals() {
ListMultimap<PatchSet.Id, PatchSetApproval> result =
MultimapBuilder.hashKeys().arrayListValues().build();
for (PatchSetApproval a : approvals.values()) {
if (!patchSets.containsKey(a.getPatchSetId())) {
@ -283,7 +284,7 @@ class ChangeNotesParser {
return Lists.reverse(allChangeMessages);
}
private Multimap<PatchSet.Id, ChangeMessage> buildMessagesByPatchSet() {
private ListMultimap<PatchSet.Id, ChangeMessage> buildMessagesByPatchSet() {
for (Collection<ChangeMessage> v :
changeMessagesByPatchSet.asMap().values()) {
Collections.reverse((List<ChangeMessage>) v);

View File

@ -22,7 +22,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.SubmitRecord;
import com.google.gerrit.reviewdb.client.Account;
@ -95,14 +95,14 @@ public abstract class ChangeNotesState {
@Nullable Set<Account.Id> pastAssignees,
@Nullable Set<String> hashtags,
Map<PatchSet.Id, PatchSet> patchSets,
Multimap<PatchSet.Id, PatchSetApproval> approvals,
ListMultimap<PatchSet.Id, PatchSetApproval> approvals,
ReviewerSet reviewers,
List<Account.Id> allPastReviewers,
List<ReviewerStatusUpdate> reviewerUpdates,
List<SubmitRecord> submitRecords,
List<ChangeMessage> allChangeMessages,
Multimap<PatchSet.Id, ChangeMessage> changeMessagesByPatchSet,
Multimap<RevId, Comment> publishedComments) {
ListMultimap<PatchSet.Id, ChangeMessage> changeMessagesByPatchSet,
ListMultimap<RevId, Comment> publishedComments) {
if (hashtags == null) {
hashtags = ImmutableSet.of();
}

View File

@ -21,7 +21,7 @@ import static com.google.gerrit.server.notedb.NoteDbTable.CHANGES;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.metrics.Timer1;
@ -167,7 +167,7 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
revisionNoteMap = RevisionNoteMap.parse(
args.noteUtil, getChangeId(), reader, NoteMap.read(reader, tipCommit),
PatchLineComment.Status.DRAFT);
Multimap<RevId, Comment> cs =
ListMultimap<RevId, Comment> cs =
MultimapBuilder.hashKeys().arrayListValues().build();
for (ChangeRevisionNote rn : revisionNoteMap.revisionNotes.values()) {
for (Comment c : rn.getComments()) {

View File

@ -18,8 +18,8 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.gerrit.server.CommentsUtil.COMMENT_ORDER;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.reviewdb.client.Comment;
import com.google.gerrit.reviewdb.client.RevId;
@ -112,8 +112,8 @@ class RevisionNoteBuilder {
this.pushCert = pushCert;
}
private Multimap<Integer, Comment> buildCommentMap() {
Multimap<Integer, Comment> all =
private ListMultimap<Integer, Comment> buildCommentMap() {
ListMultimap<Integer, Comment> all =
MultimapBuilder.hashKeys().arrayListValues().build();
for (Comment c : baseComments) {
@ -131,7 +131,7 @@ class RevisionNoteBuilder {
private void buildNoteJson(ChangeNoteUtil noteUtil, OutputStream out)
throws IOException {
Multimap<Integer, Comment> comments = buildCommentMap();
ListMultimap<Integer, Comment> comments = buildCommentMap();
if (comments.isEmpty() && pushCert == null) {
return;
}

View File

@ -15,7 +15,7 @@
package com.google.gerrit.server.notedb;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Change;
@ -95,7 +95,7 @@ public class RobotCommentNotes extends AbstractChangeNotes<RobotCommentNotes> {
ObjectReader reader = handle.walk().getObjectReader();
revisionNoteMap = RevisionNoteMap.parseRobotComments(args.noteUtil, reader,
NoteMap.read(reader, tipCommit));
Multimap<RevId, RobotComment> cs =
ListMultimap<RevId, RobotComment> cs =
MultimapBuilder.hashKeys().arrayListValues().build();
for (RobotCommentsRevisionNote rn :
revisionNoteMap.revisionNotes.values()) {

View File

@ -25,9 +25,9 @@ import static java.util.stream.Collectors.toList;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
@ -299,7 +299,7 @@ public class ChangeRebuilderImpl extends ChangeRebuilder {
// We will rebuild all events, except for draft comments, in buckets based
// on author and timestamp.
List<Event> events = new ArrayList<>();
Multimap<Account.Id, DraftCommentEvent> draftCommentEvents =
ListMultimap<Account.Id, DraftCommentEvent> draftCommentEvents =
MultimapBuilder.hashKeys().arrayListValues().build();
events.addAll(getHashtagsEvents(change, manager));

View File

@ -19,7 +19,7 @@ import static com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnn
import static com.google.gerrit.server.plugins.PluginGuiceEnvironment.is;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.annotations.Export;
import com.google.gerrit.extensions.annotations.ExtensionPoint;
import com.google.gerrit.extensions.annotations.Listen;
@ -54,7 +54,7 @@ class AutoRegisterModules {
private final ModuleGenerator httpGen;
private Set<Class<?>> sysSingletons;
private Multimap<TypeLiteral<?>, Class<?>> sysListen;
private ListMultimap<TypeLiteral<?>, Class<?>> sysListen;
private String initJs;
Module sysModule;

View File

@ -19,9 +19,9 @@ import static com.google.common.collect.Iterables.transform;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import org.eclipse.jgit.util.IO;
@ -67,7 +67,7 @@ public class JarScanner implements PluginContentScanner, AutoCloseable {
String pluginName, Iterable<Class<? extends Annotation>> annotations)
throws InvalidPluginException {
Set<String> descriptors = new HashSet<>();
Multimap<String, JarScanner.ClassData> rawMap =
ListMultimap<String, JarScanner.ClassData> rawMap =
MultimapBuilder.hashKeys().arrayListValues().build();
Map<Class<? extends Annotation>, String> classObjToClassDescr =
new HashMap<>();

View File

@ -24,8 +24,8 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import com.google.common.io.ByteStreams;
import com.google.gerrit.extensions.annotations.PluginName;
@ -399,7 +399,7 @@ public class PluginLoader implements LifecycleListener {
}
public synchronized void rescan() {
Multimap<String, Path> pluginsFiles = prunePlugins(pluginsDir);
SetMultimap<String, Path> pluginsFiles = prunePlugins(pluginsDir);
if (pluginsFiles.isEmpty()) {
return;
}
@ -478,7 +478,7 @@ public class PluginLoader implements LifecycleListener {
return sortedPlugins;
}
private void syncDisabledPlugins(Multimap<String, Path> jars) {
private void syncDisabledPlugins(SetMultimap<String, Path> jars) {
stopRemovedPlugins(jars);
dropRemovedDisabledPlugins(jars);
}
@ -525,7 +525,7 @@ public class PluginLoader implements LifecycleListener {
}
}
private void stopRemovedPlugins(Multimap<String, Path> jars) {
private void stopRemovedPlugins(SetMultimap<String, Path> jars) {
Set<String> unload = Sets.newHashSet(running.keySet());
for (Map.Entry<String, Collection<Path>> entry : jars.asMap().entrySet()) {
for (Path path : entry.getValue()) {
@ -539,7 +539,7 @@ public class PluginLoader implements LifecycleListener {
}
}
private void dropRemovedDisabledPlugins(Multimap<String, Path> jars) {
private void dropRemovedDisabledPlugins(SetMultimap<String, Path> jars) {
Set<String> unload = Sets.newHashSet(disabled.keySet());
for (Map.Entry<String, Collection<Path>> entry : jars.asMap().entrySet()) {
for (Path path : entry.getValue()) {
@ -644,7 +644,7 @@ public class PluginLoader implements LifecycleListener {
// Only one active plugin per plugin name can exist for each plugin name.
// Filter out disabled plugins and transform the multimap to a map
private static Map<String, Path> filterDisabled(
Multimap<String, Path> pluginPaths) {
SetMultimap<String, Path> pluginPaths) {
Map<String, Path> activePlugins = Maps.newHashMapWithExpectedSize(
pluginPaths.keys().size());
for (String name : pluginPaths.keys()) {
@ -667,9 +667,9 @@ public class PluginLoader implements LifecycleListener {
//
// NOTE: Bear in mind that the plugin name can be reassigned after load by the
// Server plugin provider.
public Multimap<String, Path> prunePlugins(Path pluginsDir) {
public SetMultimap<String, Path> prunePlugins(Path pluginsDir) {
List<Path> pluginPaths = scanPathsInPluginsDirectory(pluginsDir);
Multimap<String, Path> map;
SetMultimap<String, Path> map;
map = asMultimap(pluginPaths);
for (String plugin : map.keySet()) {
Collection<Path> files = map.asMap().get(plugin);
@ -735,8 +735,8 @@ public class PluginLoader implements LifecycleListener {
return null;
}
private Multimap<String, Path> asMultimap(List<Path> plugins) {
Multimap<String, Path> map = LinkedHashMultimap.create();
private SetMultimap<String, Path> asMultimap(List<Path> plugins) {
SetMultimap<String, Path> map = LinkedHashMultimap.create();
for (Path srcPath : plugins) {
map.put(getPluginName(srcPath), srcPath);
}

View File

@ -18,9 +18,9 @@ import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.gerrit.server.project.RefPattern.isRE;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.AccessSection;
@ -118,7 +118,7 @@ public class PermissionCollection {
HashMap<String, List<PermissionRule>> permissions = new HashMap<>();
HashMap<String, List<PermissionRule>> overridden = new HashMap<>();
Map<PermissionRule, ProjectRef> ruleProps = Maps.newIdentityHashMap();
Multimap<Project.NameKey, String> exclusivePermissionsByProject =
ListMultimap<Project.NameKey, String> exclusivePermissionsByProject =
MultimapBuilder.hashKeys().arrayListValues().build();
for (AccessSection section : sections) {
Project.NameKey project = sectionToProject.get(section);

View File

@ -24,12 +24,10 @@ import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.SubmitRecord;
import com.google.gerrit.common.data.SubmitTypeRecord;
@ -352,7 +350,7 @@ public class ChangeData {
private Map<Account.Id, Ref> draftsByUser;
@Deprecated
private Set<Account.Id> starredByUser;
private ImmutableMultimap<Account.Id, String> stars;
private ImmutableListMultimap<Account.Id, String> stars;
private ImmutableMap<Account.Id, StarRef> starRefs;
private ReviewerSet reviewers;
private List<ReviewerStatusUpdate> reviewerUpdates;
@ -1230,13 +1228,13 @@ public class ChangeData {
this.starredByUser = starredByUser;
}
public ImmutableMultimap<Account.Id, String> stars() throws OrmException {
public ImmutableListMultimap<Account.Id, String> stars() throws OrmException {
if (stars == null) {
if (!lazyLoad) {
return ImmutableMultimap.of();
return ImmutableListMultimap.of();
}
ImmutableMultimap.Builder<Account.Id, String> b =
ImmutableMultimap.builder();
ImmutableListMultimap.Builder<Account.Id, String> b =
ImmutableListMultimap.builder();
for (Map.Entry<Account.Id, StarRef> e : starRefs().entrySet()) {
b.putAll(e.getKey(), e.getValue().labels());
}
@ -1245,8 +1243,8 @@ public class ChangeData {
return stars;
}
public void setStars(Multimap<Account.Id, String> stars) {
this.stars = ImmutableMultimap.copyOf(stars);
public void setStars(ListMultimap<Account.Id, String> stars) {
this.stars = ImmutableListMultimap.copyOf(stars);
}
public ImmutableMap<Account.Id, StarRef> starRefs() throws OrmException {

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server.schema;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
@ -100,9 +100,9 @@ public class Schema_108 extends SchemaVersion {
}
}
Multimap<ObjectId, Ref> changeRefsBySha =
ListMultimap<ObjectId, Ref> changeRefsBySha =
MultimapBuilder.hashKeys().arrayListValues().build();
Multimap<ObjectId, PatchSet.Id> patchSetsBySha =
ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha =
MultimapBuilder.hashKeys().arrayListValues().build();
for (Ref ref : refdb.getRefs(RefNames.REFS_CHANGES).values()) {
ObjectId id = ref.getObjectId();
@ -132,7 +132,7 @@ public class Schema_108 extends SchemaVersion {
}
private static void updateGroups(ReviewDb db, GroupCollector collector,
Multimap<ObjectId, PatchSet.Id> patchSetsBySha) throws OrmException {
ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha) throws OrmException {
Map<PatchSet.Id, PatchSet> patchSets =
db.patchSets().toMap(db.patchSets().get(patchSetsBySha.values()));
for (Map.Entry<ObjectId, Collection<String>> e

View File

@ -14,7 +14,7 @@
package com.google.gerrit.server.schema;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
@ -57,7 +57,7 @@ public class Schema_123 extends SchemaVersion {
@Override
protected void migrateData(ReviewDb db, UpdateUI ui)
throws OrmException, SQLException {
Multimap<Account.Id, Change.Id> imports =
ListMultimap<Account.Id, Change.Id> imports =
MultimapBuilder.hashKeys().arrayListValues().build();
try (Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
ResultSet rs = stmt.executeQuery(

View File

@ -17,7 +17,7 @@ package com.google.gerrit.server.schema;
import static java.util.Comparator.comparing;
import com.google.common.base.Strings;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Ordering;
import com.google.gerrit.reviewdb.client.Account;
@ -71,7 +71,7 @@ public class Schema_124 extends SchemaVersion {
@Override
protected void migrateData(ReviewDb db, UpdateUI ui)
throws OrmException, SQLException {
Multimap<Account.Id, AccountSshKey> imports =
ListMultimap<Account.Id, AccountSshKey> imports =
MultimapBuilder.hashKeys().arrayListValues().build();
try (Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
ResultSet rs = stmt.executeQuery(

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server.schema;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Project;
@ -73,7 +73,7 @@ public class Schema_139 extends SchemaVersion {
@Override
protected void migrateData(ReviewDb db, UpdateUI ui)
throws OrmException, SQLException {
Multimap<Account.Id, ProjectWatch> imports = ArrayListMultimap.create();
ListMultimap<Account.Id, ProjectWatch> imports = ArrayListMultimap.create();
try (Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT "
@ -183,4 +183,4 @@ public class Schema_139 extends SchemaVersion {
abstract ProjectWatch build();
}
}
}
}

View File

@ -17,9 +17,8 @@ package com.google.gerrit.server.git;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.SortedSetMultimap;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
@ -47,7 +46,7 @@ public class GroupCollectorTest {
RevCommit branchTip = tr.commit().create();
RevCommit a = tr.commit().parent(branchTip).create();
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(a, branchTip),
patchSets(),
groups());
@ -62,7 +61,7 @@ public class GroupCollectorTest {
RevCommit a = tr.commit().parent(branchTip).create();
RevCommit b = tr.commit().parent(a).create();
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(b, branchTip),
patchSets(),
groups());
@ -79,7 +78,7 @@ public class GroupCollectorTest {
RevCommit b = tr.commit().parent(a).create();
String group = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(b, branchTip),
patchSets().put(a, psId(1, 1)),
groups().put(psId(1, 1), group));
@ -95,7 +94,7 @@ public class GroupCollectorTest {
RevCommit a = tr.commit().parent(branchTip).create();
RevCommit b = tr.commit().parent(a).create();
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(b, branchTip),
patchSets().put(a, psId(1, 1)),
groups());
@ -111,7 +110,7 @@ public class GroupCollectorTest {
RevCommit b = tr.commit().parent(branchTip).create();
RevCommit m = tr.commit().parent(a).parent(b).create();
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets(),
groups());
@ -129,7 +128,7 @@ public class GroupCollectorTest {
RevCommit m = tr.commit().parent(a).parent(b).create();
String group = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets().put(b, psId(1, 1)),
groups().put(psId(1, 1), group));
@ -150,7 +149,7 @@ public class GroupCollectorTest {
String group1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
String group2 = "1234567812345678123456781234567812345678";
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets()
.put(a, psId(1, 1))
@ -176,7 +175,7 @@ public class GroupCollectorTest {
String group1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
String group2a = "1234567812345678123456781234567812345678";
String group2b = "ef123456ef123456ef123456ef123456ef123456";
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets()
.put(a, psId(1, 1))
@ -202,7 +201,7 @@ public class GroupCollectorTest {
RevCommit m = tr.commit().parent(branchTip).parent(a).create();
String group = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets().put(a, psId(1, 1)),
groups().put(psId(1, 1), group));
@ -218,7 +217,7 @@ public class GroupCollectorTest {
RevCommit a = tr.commit().parent(branchTip).create();
RevCommit m = tr.commit().parent(branchTip).parent(a).create();
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets(),
groups());
@ -237,7 +236,7 @@ public class GroupCollectorTest {
RevCommit m1 = tr.commit().parent(b).parent(c).create();
RevCommit m2 = tr.commit().parent(a).parent(m1).create();
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m2, branchTip),
patchSets(),
groups());
@ -259,7 +258,7 @@ public class GroupCollectorTest {
assertThat(m.getParentCount()).isEqualTo(2);
assertThat(m.getParent(0)).isEqualTo(m.getParent(1));
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets(),
groups());
@ -279,7 +278,7 @@ public class GroupCollectorTest {
String group1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
String group2 = "1234567812345678123456781234567812345678";
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
newWalk(m, branchTip),
patchSets()
.put(a, psId(1, 1))
@ -307,7 +306,7 @@ public class GroupCollectorTest {
rw.markStart(rw.parseCommit(d));
// Schema upgrade case: all commits are existing patch sets, but none have
// groups assigned yet.
Multimap<ObjectId, String> groups = collectGroups(
SortedSetMultimap<ObjectId, String> groups = collectGroups(
rw,
patchSets()
.put(branchTip, psId(1, 1))
@ -339,9 +338,9 @@ public class GroupCollectorTest {
return rw;
}
private static Multimap<ObjectId, String> collectGroups(
private static SortedSetMultimap<ObjectId, String> collectGroups(
RevWalk rw,
ImmutableMultimap.Builder<ObjectId, PatchSet.Id> patchSetsBySha,
ImmutableListMultimap.Builder<ObjectId, PatchSet.Id> patchSetsBySha,
ImmutableListMultimap.Builder<PatchSet.Id, String> groupLookup)
throws Exception {
GroupCollector gc =
@ -355,8 +354,9 @@ public class GroupCollectorTest {
// Helper methods for constructing various map arguments, to avoid lots of
// type specifications.
private static ImmutableMultimap.Builder<ObjectId, PatchSet.Id> patchSets() {
return ImmutableMultimap.builder();
private static ImmutableListMultimap.Builder<ObjectId, PatchSet.Id>
patchSets() {
return ImmutableListMultimap.builder();
}
private static ImmutableListMultimap.Builder<PatchSet.Id, String> groups() {

View File

@ -21,7 +21,7 @@ import static com.google.gerrit.testutil.TestChanges.newChange;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.stream.Collectors.toList;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.reviewdb.client.Account;
@ -194,7 +194,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name()),
P2, RefState.create(ref2, id2.name())),
ImmutableMultimap.of()))
ImmutableListMultimap.of()))
.isFalse();
// Wrong ref value.
@ -204,7 +204,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, SHA1),
P2, RefState.create(ref2, id2.name())),
ImmutableMultimap.of()))
ImmutableListMultimap.of()))
.isTrue();
// Swapped repos.
@ -214,7 +214,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id2.name()),
P2, RefState.create(ref2, id1.name())),
ImmutableMultimap.of()))
ImmutableListMultimap.of()))
.isTrue();
// Two refs in same repo, not stale.
@ -227,7 +227,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name()),
P1, RefState.create(ref3, id3.name())),
ImmutableMultimap.of()))
ImmutableListMultimap.of()))
.isFalse();
// Ignore ref not mentioned.
@ -236,7 +236,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
repoManager, C,
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name())),
ImmutableMultimap.of()))
ImmutableListMultimap.of()))
.isFalse();
// One ref wrong.
@ -246,7 +246,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name()),
P1, RefState.create(ref3, SHA1)),
ImmutableMultimap.of()))
ImmutableListMultimap.of()))
.isTrue();
}
@ -261,7 +261,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
repoManager, C,
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name())),
ImmutableMultimap.of(
ImmutableListMultimap.of(
P1, RefStatePattern.create("refs/heads/*"))))
.isFalse();
@ -273,7 +273,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
repoManager, C,
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name())),
ImmutableMultimap.of(
ImmutableListMultimap.of(
P1, RefStatePattern.create("refs/heads/*"))))
.isTrue();
assertThat(
@ -282,7 +282,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name()),
P1, RefState.create(ref2, id2.name())),
ImmutableMultimap.of(
ImmutableListMultimap.of(
P1, RefStatePattern.create("refs/heads/*"))))
.isFalse();
}
@ -299,7 +299,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
repoManager, C,
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name())),
ImmutableMultimap.of(
ImmutableListMultimap.of(
P1, RefStatePattern.create("refs/*/foo"))))
.isFalse();
@ -311,7 +311,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
repoManager, C,
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name())),
ImmutableMultimap.of(
ImmutableListMultimap.of(
P1, RefStatePattern.create("refs/*/foo"))))
.isTrue();
assertThat(
@ -320,7 +320,7 @@ public class StalenessCheckerTest extends GerritBaseTests {
ImmutableSetMultimap.of(
P1, RefState.create(ref1, id1.name()),
P1, RefState.create(ref3, id3.name())),
ImmutableMultimap.of(
ImmutableListMultimap.of(
P1, RefStatePattern.create("refs/*/foo"))))
.isFalse();
}

View File

@ -26,7 +26,6 @@ import static org.junit.Assert.fail;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableTable;
import com.google.common.collect.Iterables;
@ -350,7 +349,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
notes = newNotes(c);
assertThat(notes.getApprovals()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
psa.getPatchSetId(),
new PatchSetApproval(psa.getKey(), (short) 0, update.getWhen())));
}
@ -375,7 +374,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
notes = newNotes(c);
assertThat(notes.getApprovals()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
psa.getPatchSetId(),
new PatchSetApproval(psa.getKey(), (short) 0, update.getWhen())));
@ -1452,7 +1451,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getComments())
.isEqualTo(ImmutableMultimap.of(revId, comment));
.isEqualTo(ImmutableListMultimap.of(revId, comment));
}
@Test
@ -1472,7 +1471,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getComments())
.isEqualTo(ImmutableMultimap.of(revId, comment));
.isEqualTo(ImmutableListMultimap.of(revId, comment));
}
@Test
@ -1492,7 +1491,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getComments())
.isEqualTo(ImmutableMultimap.of(revId, comment));
.isEqualTo(ImmutableListMultimap.of(revId, comment));
}
@Test
@ -1512,7 +1511,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getComments())
.isEqualTo(ImmutableMultimap.of(revId, comment));
.isEqualTo(ImmutableListMultimap.of(revId, comment));
}
@Test
@ -1822,7 +1821,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
}
}
assertThat(notes.getComments()).isEqualTo(
ImmutableMultimap.of(
ImmutableListMultimap.of(
revId, comment1,
revId, comment2,
revId, comment3));
@ -1879,7 +1878,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
}
}
assertThat(notes.getComments())
.isEqualTo(ImmutableMultimap.of(revId, comment));
.isEqualTo(ImmutableListMultimap.of(revId, comment));
}
@Test
@ -1934,7 +1933,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
}
}
assertThat(notes.getComments())
.isEqualTo(ImmutableMultimap.of(new RevId(comment.revId), comment));
.isEqualTo(ImmutableListMultimap.of(new RevId(comment.revId), comment));
}
@Test
@ -1969,7 +1968,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(newNotes(c).getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev1), commentForBase,
new RevId(rev2), commentForPS));
}
@ -2004,7 +2003,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(newNotes(c).getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev), comment1,
new RevId(rev), comment2)).inOrder();
}
@ -2039,7 +2038,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(newNotes(c).getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev), comment1,
new RevId(rev), comment2)).inOrder();
}
@ -2077,7 +2076,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(newNotes(c).getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev1), comment1,
new RevId(rev2), comment2));
}
@ -2103,7 +2102,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getDraftComments(otherUserId)).containsExactlyEntriesIn(
ImmutableMultimap.of(new RevId(rev), comment1));
ImmutableListMultimap.of(new RevId(rev), comment1));
assertThat(notes.getComments()).isEmpty();
update = newUpdate(c, otherUser);
@ -2114,7 +2113,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
notes = newNotes(c);
assertThat(notes.getDraftComments(otherUserId)).isEmpty();
assertThat(notes.getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(new RevId(rev), comment1));
ImmutableListMultimap.of(new RevId(rev), comment1));
}
@Test
@ -2146,7 +2145,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getDraftComments(otherUserId)).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev), comment1,
new RevId(rev), comment2)).inOrder();
assertThat(notes.getComments()).isEmpty();
@ -2159,9 +2158,9 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
notes = newNotes(c);
assertThat(notes.getDraftComments(otherUserId)).containsExactlyEntriesIn(
ImmutableMultimap.of(new RevId(rev), comment2));
ImmutableListMultimap.of(new RevId(rev), comment2));
assertThat(notes.getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(new RevId(rev), comment1));
ImmutableListMultimap.of(new RevId(rev), comment1));
}
@Test
@ -2194,7 +2193,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
ChangeNotes notes = newNotes(c);
assertThat(notes.getDraftComments(otherUserId)).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev1), baseComment,
new RevId(rev2), psComment));
assertThat(notes.getComments()).isEmpty();
@ -2210,7 +2209,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
notes = newNotes(c);
assertThat(notes.getDraftComments(otherUserId)).isEmpty();
assertThat(notes.getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(
ImmutableListMultimap.of(
new RevId(rev1), baseComment,
new RevId(rev2), psComment));
}
@ -2373,7 +2372,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(newNotes(c).getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(new RevId(rev), comment));
ImmutableListMultimap.of(new RevId(rev), comment));
}
@Test
@ -2393,7 +2392,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
assertThat(newNotes(c).getComments()).containsExactlyEntriesIn(
ImmutableMultimap.of(new RevId(rev), comment));
ImmutableListMultimap.of(new RevId(rev), comment));
}
@Test

View File

@ -18,7 +18,7 @@ import static com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnn
import com.google.common.base.Preconditions;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.extensions.annotations.Export;
import com.google.gerrit.server.plugins.InvalidPluginException;
import com.google.gerrit.server.plugins.ModuleGenerator;
@ -36,7 +36,8 @@ class SshAutoRegisterModuleGenerator
extends AbstractModule
implements ModuleGenerator {
private final Map<String, Class<Command>> commands = new HashMap<>();
private final Multimap<TypeLiteral<?>, Class<?>> listeners = LinkedListMultimap.create();
private final ListMultimap<TypeLiteral<?>, Class<?>> listeners =
LinkedListMultimap.create();
private CommandName command;
@Override

View File

@ -15,7 +15,7 @@
package com.google.gerrit.sshd;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ListMultimap;
import com.google.gerrit.audit.AuditService;
import com.google.gerrit.audit.SshAuditEvent;
import com.google.gerrit.common.TimeUtil;
@ -156,14 +156,14 @@ class SshLog implements LifecycleListener {
audit(context.get(), status, dcmd);
}
private Multimap<String, ?> extractParameters(DispatchCommand dcmd) {
private ListMultimap<String, ?> extractParameters(DispatchCommand dcmd) {
if (dcmd == null) {
return ArrayListMultimap.create(0, 0);
}
String[] cmdArgs = dcmd.getArguments();
String paramName = null;
int argPos = 0;
Multimap<String, String> parms = ArrayListMultimap.create();
ListMultimap<String, String> parms = ArrayListMultimap.create();
for (int i = 2; i < cmdArgs.length; i++) {
String arg = cmdArgs[i];
// -- stop parameters parsing
@ -258,7 +258,8 @@ class SshLog implements LifecycleListener {
audit(ctx, result, extractWhat(cmd), extractParameters(cmd));
}
private void audit(Context ctx, Object result, String cmd, Multimap<String, ?> params) {
private void audit(Context ctx, Object result, String cmd,
ListMultimap<String, ?> params) {
String sessionId;
CurrentUser currentUser;
long created;

View File

@ -35,9 +35,9 @@
package com.google.gerrit.util.cli;
import com.google.common.base.Strings;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@ -224,7 +224,7 @@ public class CmdLineParser {
public void parseOptionMap(Map<String, String[]> parameters)
throws CmdLineException {
Multimap<String, String> map = LinkedHashMultimap.create();
ListMultimap<String, String> map = ArrayListMultimap.create();
for (Map.Entry<String, String[]> ent : parameters.entrySet()) {
for (String val : ent.getValue()) {
map.put(ent.getKey(), val);
@ -233,7 +233,7 @@ public class CmdLineParser {
parseOptionMap(map);
}
public void parseOptionMap(Multimap<String, String> params)
public void parseOptionMap(ListMultimap<String, String> params)
throws CmdLineException {
List<String> tmp = Lists.newArrayListWithCapacity(2 * params.size());
for (final String key : params.keySet()) {

@ -1 +1 @@
Subproject commit 860742125749aec5444bfa44bb727153c2649893
Subproject commit ea6c8c3949cecfd6547ce1e97d2dddbb2669e827

@ -1 +1 @@
Subproject commit 0ed3b13df0b4f88c67ece722e56e554f8f38e83a
Subproject commit 66f08f2460ba89b6827f4e456be1c1a948a718aa