Merge branch 'stable-3.1'

* stable-3.1:
  Update doc for addMenuLink
  Add shared style module for change-view-integration
  Remove ::content and fix the `no-left` style for shift + a
  Project.NameKey: Implement Serializable
  Fix create change api

Change-Id: I144dc45bbf28f1a3145f2c92a144ef2bf4bc79d4
This commit is contained in:
David Pursehouse
2019-10-23 08:04:15 +09:00
5 changed files with 15 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ import static java.util.Objects.requireNonNull;
import com.google.gerrit.extensions.client.InheritableBoolean;
import com.google.gerrit.extensions.client.ProjectState;
import com.google.gerrit.extensions.client.SubmitType;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -46,7 +47,9 @@ public final class Project {
* unlike other key types in this package. However, this is strictly an implementation detail; its
* interface and semantics are otherwise analogous to the {@code @AutoValue} types.
*/
public static class NameKey implements Comparable<NameKey> {
public static class NameKey implements Serializable, Comparable<NameKey> {
private static final long serialVersionUID = 1L;
/** Parse a Project.NameKey out of a string representation. */
public static NameKey parse(String str) {
return nameKey(KeyUtil.decode(str));

View File

@@ -18,6 +18,8 @@ import com.google.gerrit.entities.Project;
/** Special name of the project that all projects derive from. */
public class AllProjectsName extends Project.NameKey {
private static final long serialVersionUID = 1L;
public AllProjectsName(String name) {
super(name);
}

View File

@@ -18,6 +18,8 @@ import com.google.gerrit.entities.Project;
/** Special name of the project in which meta data for all users is stored. */
public class AllUsersName extends Project.NameKey {
private static final long serialVersionUID = 1L;
public AllUsersName(String name) {
super(name);
}

View File

@@ -4,6 +4,7 @@ junit_tests(
name = "tests",
srcs = glob(["*.java"]),
deps = [
"//java/com/google/gerrit/entities",
"//java/com/google/gerrit/server/cache/serialize",
"//java/com/google/gerrit/server/cache/testing",
"//java/com/google/gerrit/testing:gerrit-test-util",

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.server.cache.serialize;
import static com.google.common.truth.Truth.assertThat;
import com.google.auto.value.AutoValue;
import com.google.gerrit.entities.Project;
import java.io.Serializable;
import org.junit.Test;
@@ -33,6 +34,11 @@ public class JavaCacheSerializerTest {
assertRoundTrip(new AutoValue_JavaCacheSerializerTest_MyType(123, "four five six"));
}
@Test
public void gerritEntities() throws Exception {
assertRoundTrip(Project.nameKey("foo"));
}
@AutoValue
abstract static class MyType implements Serializable {
private static final long serialVersionUID = 1L;