Merge "Fix gr-repo's shared-styles tag"
diff --git a/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java b/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
index b2eb62d..f3ab847 100644
--- a/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
+++ b/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
@@ -15,8 +15,8 @@
 package com.google.gerrit.server.change;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
 
+import com.google.auto.value.AutoValue;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.cache.Cache;
 import com.google.common.cache.Weigher;
@@ -50,6 +50,7 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import org.eclipse.jgit.errors.LargeObjectException;
+import org.eclipse.jgit.lib.AnyObjectId;
 import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectInserter;
@@ -104,7 +105,7 @@
         ObjectId prior,
         ObjectId next) {
       try {
-        Key key = new Key(prior, next, useRecursiveMerge);
+        Key key = Key.create(prior, next, useRecursiveMerge);
         return new Loader(key, repoManager, project, rw, repoConfig).call();
       } catch (IOException e) {
         log.warn(
@@ -125,52 +126,21 @@
     }
   }
 
-  public static class Key {
-    private transient ObjectId prior;
-    private transient ObjectId next;
-    private transient String strategyName;
-
-    private Key(ObjectId prior, ObjectId next, boolean useRecursiveMerge) {
-      checkNotNull(next, "next");
-      String strategyName = MergeUtil.mergeStrategyName(true, useRecursiveMerge);
-      this.prior = prior.copy();
-      this.next = next.copy();
-      this.strategyName = strategyName;
+  @AutoValue
+  public abstract static class Key {
+    public static Key create(AnyObjectId prior, AnyObjectId next, String strategyName) {
+      return new AutoValue_ChangeKindCacheImpl_Key(prior.copy(), next.copy(), strategyName);
     }
 
-    public Key(ObjectId prior, ObjectId next, String strategyName) {
-      this.prior = prior;
-      this.next = next;
-      this.strategyName = strategyName;
+    private static Key create(AnyObjectId prior, AnyObjectId next, boolean useRecursiveMerge) {
+      return create(prior, next, MergeUtil.mergeStrategyName(true, useRecursiveMerge));
     }
 
-    public ObjectId getPrior() {
-      return prior;
-    }
+    public abstract ObjectId prior();
 
-    public ObjectId getNext() {
-      return next;
-    }
+    public abstract ObjectId next();
 
-    public String getStrategyName() {
-      return strategyName;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (o instanceof Key) {
-        Key k = (Key) o;
-        return Objects.equals(prior, k.prior)
-            && Objects.equals(next, k.next)
-            && Objects.equals(strategyName, k.strategyName);
-      }
-      return false;
-    }
-
-    @Override
-    public int hashCode() {
-      return Objects.hash(prior, next, strategyName);
-    }
+    public abstract String strategyName();
 
     @VisibleForTesting
     static class Serializer implements CacheSerializer<Key> {
@@ -179,9 +149,9 @@
         ObjectIdConverter idConverter = ObjectIdConverter.create();
         return ProtoCacheSerializers.toByteArray(
             ChangeKindKeyProto.newBuilder()
-                .setPrior(idConverter.toByteString(object.getPrior()))
-                .setNext(idConverter.toByteString(object.getNext()))
-                .setStrategyName(object.getStrategyName())
+                .setPrior(idConverter.toByteString(object.prior()))
+                .setNext(idConverter.toByteString(object.next()))
+                .setStrategyName(object.strategyName())
                 .build());
       }
 
@@ -190,7 +160,7 @@
         ChangeKindKeyProto proto =
             ProtoCacheSerializers.parseUnchecked(ChangeKindKeyProto.parser(), in);
         ObjectIdConverter idConverter = ObjectIdConverter.create();
-        return new Key(
+        return create(
             idConverter.fromByteString(proto.getPrior()),
             idConverter.fromByteString(proto.getNext()),
             proto.getStrategyName());
@@ -226,7 +196,7 @@
     @SuppressWarnings("resource") // Resources are manually managed.
     @Override
     public ChangeKind call() throws IOException {
-      if (Objects.equals(key.prior, key.next)) {
+      if (Objects.equals(key.prior(), key.next())) {
         return ChangeKind.NO_CODE_CHANGE;
       }
 
@@ -239,9 +209,9 @@
         config = repo.getConfig();
       }
       try {
-        RevCommit prior = rw.parseCommit(key.prior);
+        RevCommit prior = rw.parseCommit(key.prior());
         rw.parseBody(prior);
-        RevCommit next = rw.parseCommit(key.next);
+        RevCommit next = rw.parseCommit(key.next());
         rw.parseBody(next);
 
         if (!next.getFullMessage().equals(prior.getFullMessage())) {
@@ -272,7 +242,7 @@
         // having the same tree as would exist when the prior commit is
         // cherry-picked onto the next commit's new first parent.
         try (ObjectInserter ins = new InMemoryInserter(rw.getObjectReader())) {
-          ThreeWayMerger merger = MergeUtil.newThreeWayMerger(ins, config, key.strategyName);
+          ThreeWayMerger merger = MergeUtil.newThreeWayMerger(ins, config, key.strategyName());
           merger.setBase(prior.getParent(0));
           if (merger.merge(next.getParent(0), prior)
               && merger.getResultTreeId().equals(next.getTree())) {
@@ -316,7 +286,7 @@
     }
 
     private static boolean isSameDeltaAndTree(RevCommit prior, RevCommit next) {
-      if (next.getTree() != prior.getTree()) {
+      if (!Objects.equals(next.getTree(), prior.getTree())) {
         return false;
       }
 
@@ -329,7 +299,7 @@
       // Make sure that the prior/next delta is the same - not just the tree.
       // This is done by making sure that the parent trees are equal.
       for (int i = 0; i < prior.getParentCount(); i++) {
-        if (next.getParent(i).getTree() != prior.getParent(i).getTree()) {
+        if (!Objects.equals(next.getParent(i).getTree(), prior.getParent(i).getTree())) {
           return false;
         }
       }
@@ -342,7 +312,7 @@
     public int weigh(Key key, ChangeKind changeKind) {
       return 16
           + 2 * 36
-          + 2 * key.strategyName.length() // Size of Key, 64 bit JVM
+          + 2 * key.strategyName().length() // Size of Key, 64 bit JVM
           + 2 * changeKind.name().length(); // Size of ChangeKind, 64 bit JVM
     }
   }
@@ -372,7 +342,7 @@
       ObjectId prior,
       ObjectId next) {
     try {
-      Key key = new Key(prior, next, useRecursiveMerge);
+      Key key = Key.create(prior, next, useRecursiveMerge);
       return cache.get(key, new Loader(key, repoManager, project, rw, repoConfig));
     } catch (ExecutionException e) {
       log.warn("Cannot check trivial rebase of new patch set " + next.name() + " in " + project, e);
diff --git a/javatests/com/google/gerrit/acceptance/pgm/ReindexIT.java b/javatests/com/google/gerrit/acceptance/pgm/ReindexIT.java
index 4b6f8b2..41640a9 100644
--- a/javatests/com/google/gerrit/acceptance/pgm/ReindexIT.java
+++ b/javatests/com/google/gerrit/acceptance/pgm/ReindexIT.java
@@ -80,6 +80,9 @@
                   .flatMap(g -> g.members.stream())
                   .map(a -> a._accountId))
           .containsExactly(adminId.get());
+      // Query project index
+      assertThat(gApi.projects().query(project.get()).get().stream().map(p -> p.name))
+          .containsExactly(project.get());
     }
   }
 
@@ -220,7 +223,7 @@
   }
 
   private void setUpChange() throws Exception {
-    project = new Project.NameKey("project");
+    project = new Project.NameKey("reindex-project-test");
     try (ServerContext ctx = startServer()) {
       GerritApi gApi = ctx.getInjector().getInstance(GerritApi.class);
       gApi.projects().create(project.get());
diff --git a/javatests/com/google/gerrit/server/change/ChangeKindCacheImplTest.java b/javatests/com/google/gerrit/server/change/ChangeKindCacheImplTest.java
index b0d7ae4..03e0d4e 100644
--- a/javatests/com/google/gerrit/server/change/ChangeKindCacheImplTest.java
+++ b/javatests/com/google/gerrit/server/change/ChangeKindCacheImplTest.java
@@ -22,6 +22,7 @@
 import com.google.common.collect.ImmutableMap;
 import com.google.gerrit.server.cache.CacheSerializer;
 import com.google.gerrit.server.cache.proto.Cache.ChangeKindKeyProto;
+import com.google.gerrit.server.change.ChangeKindCacheImpl.Key;
 import org.eclipse.jgit.lib.ObjectId;
 import org.junit.Test;
 
@@ -29,7 +30,7 @@
   @Test
   public void keySerializer() throws Exception {
     ChangeKindCacheImpl.Key key =
-        new ChangeKindCacheImpl.Key(
+        Key.create(
             ObjectId.zeroId(),
             ObjectId.fromString("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"),
             "aStrategy");
@@ -55,7 +56,7 @@
   @Test
   public void keyFields() throws Exception {
     assertThatSerializedClass(ChangeKindCacheImpl.Key.class)
-        .hasFields(
+        .hasAutoValueMethods(
             ImmutableMap.of(
                 "prior", ObjectId.class, "next", ObjectId.class, "strategyName", String.class));
   }
diff --git a/lib/js/bower_archives.bzl b/lib/js/bower_archives.bzl
index 5ee3535..6b4e003 100644
--- a/lib/js/bower_archives.bzl
+++ b/lib/js/bower_archives.bzl
@@ -65,8 +65,8 @@
   bower_archive(
     name = "iron-menu-behavior",
     package = "PolymerElements/iron-menu-behavior",
-    version = "2.0.1",
-    sha1 = "139528ee1e8d86257e2aa445de7761b8ec70ae91")
+    version = "2.1.1",
+    sha1 = "1504997f6eb9aec490b855dadee473cac064f38c")
   bower_archive(
     name = "iron-meta",
     package = "PolymerElements/iron-meta",
@@ -105,8 +105,8 @@
   bower_archive(
     name = "paper-icon-button",
     package = "PolymerElements/paper-icon-button",
-    version = "2.1.0",
-    sha1 = "caead6a276877888d128ace809376980c3f3fe42")
+    version = "2.2.0",
+    sha1 = "9525e76ef433428bb9d6ec4fa65c4ef83156a803")
   bower_archive(
     name = "paper-ripple",
     package = "PolymerElements/paper-ripple",
diff --git a/polygerrit-ui/app/styles/gr-change-list-styles.html b/polygerrit-ui/app/styles/gr-change-list-styles.html
index 7379b9c..410389b 100644
--- a/polygerrit-ui/app/styles/gr-change-list-styles.html
+++ b/polygerrit-ui/app/styles/gr-change-list-styles.html
@@ -68,7 +68,6 @@
       }
       .topHeader th {
         background-color: var(--table-header-background-color);
-        font-size: var(--font-size-large);
         height: 3rem;
         position: -webkit-sticky;
         position: sticky;
diff --git a/polygerrit-ui/app/styles/gr-table-styles.html b/polygerrit-ui/app/styles/gr-table-styles.html
index 5e40735..cf4e84e 100644
--- a/polygerrit-ui/app/styles/gr-table-styles.html
+++ b/polygerrit-ui/app/styles/gr-table-styles.html
@@ -71,11 +71,11 @@
       }
       .genericList .topHeader {
         background-color: var(--table-header-background-color);
-        font-size: var(--font-size-large);
         height: 3rem;
       }
       .genericList .groupHeader {
         background-color: var(--table-subheader-background-color);
+        font-size: var(--font-size-large);
       }
       .genericList a {
         color: var(--primary-text-color);
diff --git a/polygerrit-ui/app/styles/themes/app-theme.html b/polygerrit-ui/app/styles/themes/app-theme.html
index 4500e10..21db329 100644
--- a/polygerrit-ui/app/styles/themes/app-theme.html
+++ b/polygerrit-ui/app/styles/themes/app-theme.html
@@ -53,7 +53,7 @@
   /* Font sizes */
   --font-size-normal: 1rem;
   --font-size-small: .92rem;
-  --font-size-large: 1.076rem;
+  --font-size-large: 1.154rem;
 
   --link-color: #2a66d9;
   --primary-button-background-color: var(--link-color);
@@ -78,14 +78,14 @@
 
   /* Diff colors */
   --diff-selection-background-color: #c7dbf9;
-  --light-remove-highlight-color: #fee;
-  --light-add-highlight-color: #efe;
-  --light-remove-add-highlight-color: #fff6ea;
-  --light-rebased-add-highlight-color: #edfffa;
-  --dark-remove-highlight-color: rgba(255, 0, 0, 0.15);
-  --dark-add-highlight-color: rgba(0, 255, 0, 0.15);
-  --dark-rebased-remove-highlight-color: rgba(255, 139, 6, 0.15);
-  --dark-rebased-add-highlight-color: rgba(11, 255, 155, 0.15);
+  --light-remove-highlight-color: #FFEBEE;
+  --light-add-highlight-color: #D8FED8;
+  --light-remove-add-highlight-color: #FFF8DC;
+  --light-rebased-add-highlight-color: #EEEEFF;
+  --dark-remove-highlight-color: #FFCDD2;
+  --dark-add-highlight-color: #AAF2AA;
+  --dark-rebased-remove-highlight-color: #F7E8B7;
+  --dark-rebased-add-highlight-color: #D7D7F9;
   --diff-context-control-color: #fff7d4;
   --diff-context-control-border-color: #f6e6a5;
   --diff-tab-indicator-color: var(--deemphasized-text-color);