Project.NameKey: Implement Serializable

Prior to Ic46c4a357 the Project.NameKey class extended StringKey and
was implicitly serializable because StringKey implements Serializable.

After Ic46c4a357, Project.NameKey is no longer serializable, which
causes an IllegalStateException when attempting to bind a cache that
uses JavaCacheSerializer with Project.NameKey as key or value.

Add back the Serializable interface and add a test to make sure it is
serializable by JavaCacheSerializer.

Bug: Issue 11793
Change-Id: Id465c3a4cd810de477fb86a13185ec452d5d3a40
This commit is contained in:
David Pursehouse
2019-10-22 17:53:56 +09:00
parent 3e05a05372
commit e0ebf9d3e5
5 changed files with 15 additions and 1 deletions

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);
}