Remove unnecessary generic type arguments

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175155365
This commit is contained in:
mcilwain 2017-11-09 07:33:40 -08:00 committed by jianglai
parent 8dcc2d6833
commit 2aa897e698
140 changed files with 355 additions and 465 deletions

View file

@ -63,7 +63,7 @@ public final class EntityClasses {
/** Set of entity classes. */
@SuppressWarnings("unchecked") // varargs
public static final ImmutableSet<Class<? extends ImmutableObject>> ALL_CLASSES =
ImmutableSet.<Class<? extends ImmutableObject>>of(
ImmutableSet.of(
BillingEvent.Cancellation.class,
BillingEvent.Modification.class,
BillingEvent.OneTime.class,

View file

@ -164,7 +164,7 @@ public final class EppResourceUtils {
ofy().load().type(clazz)
.filter(filterDefinition, filterValue)
.filter("deletionTime >", now.toDate()),
EppResourceUtils.<T>transformAtTime(now));
EppResourceUtils.transformAtTime(now));
}
/**

View file

@ -211,7 +211,7 @@ public final class RegistrarCreditBalance extends ImmutableObject implements Bui
private Optional<Money> getMostRecentlyWrittenBalance(
Map.Entry<DateTime, ImmutableSortedMap<DateTime, Money>> balancesAtEffectiveTime) {
return balancesAtEffectiveTime == null
? Optional.<Money>empty()
? Optional.empty()
// Don't use Optional.ofNullable() here since it's an error if there's a empty submap.
: Optional.of(balancesAtEffectiveTime.getValue().lastEntry().getValue());
}

View file

@ -162,7 +162,7 @@ public class TimedTransitionProperty<V, T extends TimedTransitionProperty.TimedT
Map<DateTime, V> newInnerMap = new HashMap<>(currentMap);
newInnerMap.put(transitionTime, transitionValue);
ImmutableSortedMap<DateTime, V> newMap =
ImmutableSortedMap.<DateTime, V>copyOf(newInnerMap);
ImmutableSortedMap.copyOf(newInnerMap);
validateTimedTransitionMap(newMap, allowedTransitions, allowedTransitionMapName);
return fromValueMap(newMap, transitionClass);
}

View file

@ -277,7 +277,7 @@ public class DomainResource extends DomainBase
transferData.getServerApproveBillingEvent())));
} else {
// There won't be a billing event, so we don't need a grace period
builder.setGracePeriods(ImmutableSet.<GracePeriod>of());
builder.setGracePeriods(ImmutableSet.of());
}
// Set all remaining transfer properties.
setAutomaticTransferSuccessProperties(builder, transferData);

View file

@ -131,7 +131,7 @@ public class EppInput extends ImmutableObject {
ResourceCommand resourceCommand = getResourceCommand();
return resourceCommand instanceof SingleResourceCommand
? Optional.of(((SingleResourceCommand) resourceCommand).getTargetId())
: Optional.<String>empty();
: Optional.empty();
}
/**

View file

@ -134,7 +134,7 @@ public class DomainApplicationIndex extends BackupGroupRoot {
public static DomainApplicationIndex createUpdatedInstance(DomainApplication application) {
DomainApplicationIndex existing = load(application.getFullyQualifiedDomainName());
ImmutableSet<Key<DomainApplication>> newKeys = CollectionUtils.union(
(existing == null ? ImmutableSet.<Key<DomainApplication>>of() : existing.getKeys()),
(existing == null ? ImmutableSet.of() : existing.getKeys()),
Key.create(application));
return createWithSpecifiedKeys(application.getFullyQualifiedDomainName(), newKeys);
}

View file

@ -59,7 +59,7 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
static final ImmutableMap<
Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>
RESOURCE_CLASS_TO_FKI_CLASS =
ImmutableMap.<Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>of(
ImmutableMap.of(
ContactResource.class, ForeignKeyContactIndex.class,
DomainResource.class, ForeignKeyDomainIndex.class,
HostResource.class, ForeignKeyHostIndex.class);
@ -119,7 +119,7 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
public static <E extends EppResource> Key<ForeignKeyIndex<E>> createKey(E resource) {
@SuppressWarnings("unchecked")
Class<E> resourceClass = (Class<E>) resource.getClass();
return Key.<ForeignKeyIndex<E>>create(mapToFkiClass(resourceClass), resource.getForeignKey());
return Key.create(mapToFkiClass(resourceClass), resource.getForeignKey());
}
/**

View file

@ -50,13 +50,13 @@ abstract class AugmentedDeleter implements Deleter {
@Override
public Result<Void> entity(Object entity) {
handleDeletion(Arrays.<Key<?>>asList(Key.create(entity)));
handleDeletion(Arrays.asList(Key.create(entity)));
return delegate.entity(entity);
}
@Override
public Result<Void> key(Key<?> key) {
handleDeletion(Arrays.<Key<?>>asList(key));
handleDeletion(Arrays.asList(key));
return delegate.keys(key);
}

View file

@ -33,7 +33,7 @@ import org.joda.time.DateTime;
/** Metadata for an {@link Ofy} transaction that saves commit logs. */
class TransactionInfo {
private static final Predicate<Object> IS_DELETE = Predicates.<Object>equalTo(Delete.SENTINEL);
private static final Predicate<Object> IS_DELETE = Predicates.equalTo(Delete.SENTINEL);
private enum Delete { SENTINEL }

View file

@ -221,8 +221,9 @@ public abstract class PollMessage extends ImmutableObject
@Override
public ImmutableList<ResponseExtension> getResponseExtensions() {
return (launchInfoResponseExtension == null) ? ImmutableList.<ResponseExtension>of() :
ImmutableList.<ResponseExtension>of(launchInfoResponseExtension);
return (launchInfoResponseExtension == null)
? ImmutableList.of()
: ImmutableList.of(launchInfoResponseExtension);
}
/** A builder for {@link OneTime} since it is immutable. */
@ -313,7 +314,7 @@ public abstract class PollMessage extends ImmutableObject
public ImmutableList<ResponseData> getResponseData() {
// Note that the event time is when the auto-renew occured, so the expiration time in the
// response should be 1 year past that, since it denotes the new expiration time.
return ImmutableList.<ResponseData>of(
return ImmutableList.of(
DomainRenewData.create(getTargetId(), getEventTime().plusYears(1)));
}

View file

@ -51,7 +51,7 @@ public class PollMessageExternalKeyConverter extends Converter<Key<PollMessage>,
* belongs to.
*/
public static final ImmutableBiMap<Class<? extends EppResource>, Long> EXTERNAL_KEY_CLASS_ID_MAP =
ImmutableBiMap.<Class<? extends EppResource>, Long>of(
ImmutableBiMap.of(
DomainBase.class, 1L,
ContactResource.class, 2L,
HostResource.class, 3L);

View file

@ -54,6 +54,6 @@ public final class StaticPremiumListPricingEngine implements PremiumPricingEngin
premiumPrice.isPresent(),
premiumPrice.orElse(registry.getStandardCreateCost()),
premiumPrice.orElse(registry.getStandardRenewCost(priceTime)),
Optional.<String>ofNullable(feeClass));
Optional.ofNullable(feeClass));
}
}

View file

@ -132,7 +132,7 @@ public abstract class BaseDomainLabelList<T extends Comparable<?>, R extends Dom
} else {
line = line.trim();
}
return line.isEmpty() ? ImmutableList.<String>of() : ImmutableList.<String>of(line, comment);
return line.isEmpty() ? ImmutableList.of() : ImmutableList.of(line, comment);
}
/** Gets the names of the tlds that reference this list. */

View file

@ -73,7 +73,7 @@ public final class PremiumListUtils {
public static Optional<Money> getPremiumPrice(String label, Registry registry) {
// If the registry has no configured premium list, then no labels are premium.
if (registry.getPremiumList() == null) {
return Optional.<Money>empty();
return Optional.empty();
}
DateTime startTime = DateTime.now(UTC);
String listName = registry.getPremiumList().getName();
@ -103,7 +103,7 @@ public final class PremiumListUtils {
private static CheckResults checkStatus(PremiumListRevision premiumListRevision, String label) {
if (!premiumListRevision.getProbablePremiumLabels().mightContain(label)) {
return CheckResults.create(BLOOM_FILTER_NEGATIVE, Optional.<Money>empty());
return CheckResults.create(BLOOM_FILTER_NEGATIVE, Optional.empty());
}
Key<PremiumListEntry> entryKey =
@ -115,7 +115,7 @@ public final class PremiumListUtils {
if (entry.isPresent()) {
return CheckResults.create(CACHED_POSITIVE, Optional.of(entry.get().getValue()));
} else {
return CheckResults.create(CACHED_NEGATIVE, Optional.<Money>empty());
return CheckResults.create(CACHED_NEGATIVE, Optional.empty());
}
}
@ -123,7 +123,7 @@ public final class PremiumListUtils {
if (entry.isPresent()) {
return CheckResults.create(UNCACHED_POSITIVE, Optional.of(entry.get().getValue()));
} else {
return CheckResults.create(UNCACHED_NEGATIVE, Optional.<Money>empty());
return CheckResults.create(UNCACHED_NEGATIVE, Optional.empty());
}
} catch (InvalidCacheLoadException | ExecutionException e) {
throw new RuntimeException("Could not load premium list entry " + entryKey, e);