From fa5607c3e1cdcd0f044b1565480a155317e98488 Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Thu, 2 Mar 2017 09:03:41 -0800 Subject: [PATCH] Use Immutable types for static final fields For constant field declarations, you should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List). This communicates to your callers important semantic guarantees ([] This change replaces constants (static final CONSTNAT_CASE) declaration type which use the general collection interface (e.g. List) with an immutable type (e.g. ImmutableList). For more info, see: [] Cleanup change automatically generated by javacflume/refactory Refactoring: //third_party/java_src/error_prone/project/core/src/main/java/com/google/errorprone/bugpatterns:MutableConstantField_refactoring Tested: TAP --sample for global presubmit queue [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149010021 --- java/google/registry/flows/domain/DomainCreateFlow.java | 3 +-- java/google/registry/tools/params/ParameterFactory.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index 8387e9c1e..59e886d21 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -93,7 +93,6 @@ import google.registry.model.registry.Registry; import google.registry.model.registry.Registry.TldState; import google.registry.model.reporting.HistoryEntry; import google.registry.tmch.LordnTask; -import java.util.Set; import javax.inject.Inject; import org.joda.time.DateTime; @@ -153,7 +152,7 @@ import org.joda.time.DateTime; public class DomainCreateFlow implements TransactionalFlow { - private static final Set SUNRISE_STATES = + private static final ImmutableSet SUNRISE_STATES = Sets.immutableEnumSet(TldState.SUNRISE, TldState.SUNRUSH); @Inject ExtensionManager extensionManager; diff --git a/java/google/registry/tools/params/ParameterFactory.java b/java/google/registry/tools/params/ParameterFactory.java index 239abe392..8d93f47be 100644 --- a/java/google/registry/tools/params/ParameterFactory.java +++ b/java/google/registry/tools/params/ParameterFactory.java @@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.net.HostAndPort; import com.google.common.net.InternetDomainName; import java.nio.file.Path; -import java.util.Map; import java.util.logging.Level; import javax.annotation.Nullable; import org.joda.money.Money; @@ -41,7 +40,7 @@ public final class ParameterFactory implements IStringConverterFactory { return (Class>) CONVERTERS.get(type); } - private static final Map, Class>> CONVERTERS = + private static final ImmutableMap, Class>> CONVERTERS = new ImmutableMap.Builder, Class>>() .put(DateTime.class, DateTimeParameter.class) .put(Duration.class, DurationParameter.class)