mirror of
https://github.com/google/nomulus.git
synced 2025-07-02 17:23:32 +02:00
Fix some issues caught by IntelliJ static code analysis
The most common issues were: * Arrays.asList() shouldn't be called with a single parameter. * Broken Javadoc @links. * Unnecessary casts and type declarations. * Unnecessary unused variable initializations. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230994311
This commit is contained in:
parent
3cf26ff9b6
commit
c6e58d3bff
39 changed files with 132 additions and 165 deletions
|
@ -50,27 +50,27 @@ public class CollectionUtils {
|
|||
|
||||
/** Turns a null set into an empty set. JAXB leaves lots of null sets lying around. */
|
||||
public static <T> Set<T> nullToEmpty(@Nullable Set<T> potentiallyNull) {
|
||||
return firstNonNull(potentiallyNull, ImmutableSet.<T>of());
|
||||
return firstNonNull(potentiallyNull, ImmutableSet.of());
|
||||
}
|
||||
|
||||
/** Turns a null list into an empty list. */
|
||||
public static <T> List<T> nullToEmpty(@Nullable List<T> potentiallyNull) {
|
||||
return firstNonNull(potentiallyNull, ImmutableList.<T>of());
|
||||
return firstNonNull(potentiallyNull, ImmutableList.of());
|
||||
}
|
||||
|
||||
/** Turns a null map into an empty map. */
|
||||
public static <T, U> Map<T, U> nullToEmpty(@Nullable Map<T, U> potentiallyNull) {
|
||||
return firstNonNull(potentiallyNull, ImmutableMap.<T, U>of());
|
||||
return firstNonNull(potentiallyNull, ImmutableMap.of());
|
||||
}
|
||||
|
||||
/** Turns a null multimap into an empty multimap. */
|
||||
public static <T, U> Multimap<T, U> nullToEmpty(@Nullable Multimap<T, U> potentiallyNull) {
|
||||
return firstNonNull(potentiallyNull, ImmutableMultimap.<T, U>of());
|
||||
return firstNonNull(potentiallyNull, ImmutableMultimap.of());
|
||||
}
|
||||
|
||||
/** Turns a null sorted map into an empty sorted map.. */
|
||||
public static <T, U> SortedMap<T, U> nullToEmpty(@Nullable SortedMap<T, U> potentiallyNull) {
|
||||
return firstNonNull(potentiallyNull, ImmutableSortedMap.<T, U>of());
|
||||
return firstNonNull(potentiallyNull, ImmutableSortedMap.of());
|
||||
}
|
||||
|
||||
/** Defensive copy helper for {@link Set}. */
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
|
||||
package google.registry.util;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.appengine.api.taskqueue.Queue;
|
||||
import com.google.appengine.api.taskqueue.TaskHandle;
|
||||
import com.google.appengine.api.taskqueue.TaskOptions;
|
||||
import com.google.appengine.api.taskqueue.TransientFailureException;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import java.io.Serializable;
|
||||
|
@ -65,7 +64,7 @@ public class TaskQueueUtils implements Serializable {
|
|||
* @return successfully enqueued task
|
||||
*/
|
||||
public TaskHandle enqueue(Queue queue, TaskOptions task) {
|
||||
return enqueue(queue, asList(task)).get(0);
|
||||
return enqueue(queue, ImmutableList.of(task)).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue