Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  UniversalGroupBackend: Fix comparison of boxed Boolean as primitive
  UniversalGroupBackend: Replace repeated log statements with single log
  Fix ModifyCollectionInEnhancedForLoop warning flagged by error prone
  Update git submodules

Change-Id: Id67d1294cc17a8e441aeff810c5b294fba95a00e
This commit is contained in:
David Pursehouse
2020-05-22 20:01:14 +09:00
2 changed files with 8 additions and 8 deletions

View File

@@ -21,8 +21,8 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.gerrit.metrics.Description;
import com.google.gerrit.metrics.Field;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/** Abstract callback metric broken down into buckets. */
@@ -67,10 +67,11 @@ abstract class BucketedCallback<V> implements BucketedMetric {
}
void doPrune() {
Set<Map.Entry<Object, BucketedCallback<V>.ValueGauge>> entries = cells.entrySet();
for (Map.Entry<Object, ValueGauge> e : entries) {
Iterator<Map.Entry<Object, ValueGauge>> it = cells.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Object, ValueGauge> e = it.next();
if (!e.getValue().set) {
entries.remove(e);
it.remove();
registry.remove(submetric(e.getKey()));
}
}

View File

@@ -60,7 +60,7 @@ public class UniversalGroupBackend implements GroupBackend {
private GroupBackend backend(AccountGroup.UUID uuid) {
if (uuid != null) {
for (PluginSetEntryContext<GroupBackend> c : backends) {
if (c.call(b -> b.handles(uuid))) {
if (Boolean.TRUE.equals(c.call(b -> b.handles(uuid)))) {
return c.get();
}
}
@@ -116,6 +116,7 @@ public class UniversalGroupBackend implements GroupBackend {
}
}
}
logger.atFine().log("Unknown GroupMembership for UUID: %s", uuid);
return null;
}
@@ -126,7 +127,6 @@ public class UniversalGroupBackend implements GroupBackend {
}
GroupMembership m = membership(uuid);
if (m == null) {
logger.atFine().log("Unknown GroupMembership for UUID: %s", uuid);
return false;
}
return m.contains(uuid);
@@ -142,7 +142,6 @@ public class UniversalGroupBackend implements GroupBackend {
}
GroupMembership m = membership(uuid);
if (m == null) {
logger.atFine().log("Unknown GroupMembership for UUID: %s", uuid);
continue;
}
lookups.put(m, uuid);
@@ -198,7 +197,7 @@ public class UniversalGroupBackend implements GroupBackend {
@Override
public boolean isVisibleToAll(AccountGroup.UUID uuid) {
for (PluginSetEntryContext<GroupBackend> c : backends) {
if (c.call(b -> b.handles(uuid))) {
if (Boolean.TRUE.equals(c.call(b -> b.handles(uuid)))) {
return c.call(b -> b.isVisibleToAll(uuid));
}
}