Use Immutable types for static final fields

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149172966
This commit is contained in:
Ben McIlwain 2017-03-03 17:38:46 -08:00
parent 034312c17d
commit 2bba5660c2
4 changed files with 28 additions and 27 deletions

View file

@ -35,7 +35,6 @@ import google.registry.model.domain.secdns.SecDnsCreateExtension;
import google.registry.model.eppinput.EppInput.CommandExtension; import google.registry.model.eppinput.EppInput.CommandExtension;
import google.registry.model.eppoutput.EppResponse.ResponseExtension; import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlSchema; import javax.xml.bind.annotation.XmlSchema;
/** Constants that define the EPP protocol version we support. */ /** Constants that define the EPP protocol version we support. */
@ -44,7 +43,8 @@ public class ProtocolDefinition {
public static final String LANGUAGE = "en"; public static final String LANGUAGE = "en";
public static final Set<String> SUPPORTED_OBJECT_SERVICES = ImmutableSet.of( public static final ImmutableSet<String> SUPPORTED_OBJECT_SERVICES =
ImmutableSet.of(
"urn:ietf:params:xml:ns:host-1.0", "urn:ietf:params:xml:ns:host-1.0",
"urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:domain-1.0",
"urn:ietf:params:xml:ns:contact-1.0"); "urn:ietf:params:xml:ns:contact-1.0");

View file

@ -62,9 +62,9 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
@Entity @Entity
public static class ForeignKeyHostIndex extends ForeignKeyIndex<HostResource> {} public static class ForeignKeyHostIndex extends ForeignKeyIndex<HostResource> {}
private static final Map< private static final ImmutableMap<
Class<? extends EppResource>, Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>
Class<? extends ForeignKeyIndex<?>>> RESOURCE_CLASS_TO_FKI_CLASS = RESOURCE_CLASS_TO_FKI_CLASS =
ImmutableMap.<Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>of( ImmutableMap.<Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>of(
ContactResource.class, ForeignKeyContactIndex.class, ContactResource.class, ForeignKeyContactIndex.class,
DomainResource.class, ForeignKeyDomainIndex.class, DomainResource.class, ForeignKeyDomainIndex.class,

View file

@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableMap;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
@ -41,7 +40,8 @@ import javax.annotation.concurrent.Immutable;
final class RdeUploadUrl implements Comparable<RdeUploadUrl> { final class RdeUploadUrl implements Comparable<RdeUploadUrl> {
public static final Protocol SFTP = new Protocol("sftp", 22); public static final Protocol SFTP = new Protocol("sftp", 22);
private static final Map<String, Protocol> ALLOWED_PROTOCOLS = ImmutableMap.of("sftp", SFTP); private static final ImmutableMap<String, Protocol> ALLOWED_PROTOCOLS =
ImmutableMap.of("sftp", SFTP);
private final Protocol protocol; private final Protocol protocol;
private final URI uri; private final URI uri;

View file

@ -34,6 +34,7 @@ import static java.util.Arrays.asList;
import com.google.appengine.api.datastore.Entity; import com.google.appengine.api.datastore.Entity;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.model.EppResource; import google.registry.model.EppResource;
@ -52,7 +53,6 @@ import google.registry.model.poll.PollMessage;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.mapreduce.MapreduceTestCase; import google.registry.testing.mapreduce.MapreduceTestCase;
import java.util.Set;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.money.Money; import org.joda.money.Money;
import org.junit.Test; import org.junit.Test;
@ -63,8 +63,9 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class KillAllEppResourcesActionTest extends MapreduceTestCase<KillAllEppResourcesAction> { public class KillAllEppResourcesActionTest extends MapreduceTestCase<KillAllEppResourcesAction> {
static final Set<String> AFFECTED_KINDS = FluentIterable static final ImmutableSet<String> AFFECTED_KINDS =
.from(asList( FluentIterable.from(
asList(
EppResourceIndex.class, EppResourceIndex.class,
ForeignKeyContactIndex.class, ForeignKeyContactIndex.class,
ForeignKeyDomainIndex.class, ForeignKeyDomainIndex.class,