Fix some statically detected code issues

This includes: unnecessary semicolons, suppress warnings, switch statements, final/private qualifiers, Optional wrapping, conditionals, both inline and non-inline variables, ternaries, Collection putAll() calls, StringBuilders, and throws declarations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244182539
This commit is contained in:
mcilwain 2019-04-18 07:34:10 -07:00 committed by jianglai
parent 9f360587ff
commit 24bb78bd16
54 changed files with 107 additions and 158 deletions

View file

@ -53,7 +53,6 @@ import google.registry.model.tmch.TmchCrl;
public final class EntityClasses {
/** Set of entity classes. */
@SuppressWarnings("unchecked") // varargs
public static final ImmutableSet<Class<? extends ImmutableObject>> ALL_CLASSES =
ImmutableSet.of(
AllocationToken.class,

View file

@ -140,7 +140,7 @@ public abstract class ImmutableObject implements Cloneable {
}
/** Helper function to recursively hydrate an ImmutableObject. */
private static final Object hydrate(Object value) {
private static Object hydrate(Object value) {
if (value instanceof Key) {
return hydrate(ofy().load().key((Key<?>) value).now());
} else if (value instanceof Map) {

View file

@ -608,7 +608,6 @@ public abstract class BillingEvent extends ImmutableObject
}
@Override
@SuppressWarnings("unchecked")
public Modification build() {
Modification instance = getInstance();
checkNotNull(instance.reason);

View file

@ -53,7 +53,7 @@ public class DesignatedContact extends ImmutableObject {
@XmlEnumValue("tech")
TECH,
/** The registrant type is not reflected in XML and exists only for internal use. */
REGISTRANT;
REGISTRANT
}
public static DesignatedContact create(Type type, Key<ContactResource> contact) {

View file

@ -60,7 +60,7 @@ public class LaunchCheckExtension extends ImmutableObject implements CommandExte
/** A check to see if there are matching trademarks on the specified domain names. */
@XmlEnumValue("claims")
CLAIMS;
CLAIMS
}
/**

View file

@ -72,7 +72,7 @@ public class LaunchCreateExtension extends LaunchExtension implements CommandExt
* uses a "first-come, first-served" model.
*/
@XmlEnumValue("registration")
REGISTRATION;
REGISTRATION
}
@XmlAttribute

View file

@ -28,7 +28,7 @@ public class RestoreCommand {
REQUEST,
@XmlEnumValue("report")
REPORT;
REPORT
}
/** The restore operation. */

View file

@ -151,14 +151,10 @@ public class EppInput extends ImmutableObject {
/** Get the extension based on type, or null. If there are multiple, it chooses the first. */
public <E extends CommandExtension> Optional<E> getSingleExtension(Class<E> clazz) {
return Optional.ofNullable(
getCommandWrapper()
.getExtensions()
.stream()
.filter(clazz::isInstance)
.map(clazz::cast)
.findFirst()
.orElse(null));
return getCommandWrapper().getExtensions().stream()
.filter(clazz::isInstance)
.map(clazz::cast)
.findFirst();
}
/** A tag that goes inside of an EPP {@literal <command>}. */
@ -225,7 +221,7 @@ public class EppInput extends ImmutableObject {
REJECT,
@XmlEnumValue("request")
REQUEST;
REQUEST
}
@XmlAttribute(name = "op")
@ -251,7 +247,7 @@ public class EppInput extends ImmutableObject {
/** Request the next poll message. */
@XmlEnumValue("req")
REQUEST;
REQUEST
}
@XmlAttribute

View file

@ -31,7 +31,7 @@ public class MarkContact extends CommonMarkContactFields {
AGENT,
@XmlEnumValue("thirdParty")
THIRD_PARTY;
THIRD_PARTY
}
@XmlAttribute

View file

@ -31,7 +31,7 @@ public class MarkHolder extends CommonMarkContactFields {
ASSIGNEE,
@XmlEnumValue("licensee")
LICENSEE;
LICENSEE
}
@XmlAttribute

View file

@ -165,7 +165,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
* This registrar is completely disabled and cannot perform any EPP actions whatsoever, nor log
* in to the registrar console.
*/
DISABLED;
DISABLED
}
/** Regex for E.164 phone number format specified by {@code contact.xsd}. */