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

@ -62,7 +62,7 @@ public class BackupUtils {
protected ImmutableObject computeNext() { protected ImmutableObject computeNext() {
EntityProto proto = new EntityProto(); EntityProto proto = new EntityProto();
if (proto.parseDelimitedFrom(input)) { // False means end of stream; other errors throw. if (proto.parseDelimitedFrom(input)) { // False means end of stream; other errors throw.
return ofy().load().<ImmutableObject>fromEntity(EntityTranslator.createFromPb(proto)); return ofy().load().fromEntity(EntityTranslator.createFromPb(proto));
} }
return endOfData(); return endOfData();
}}; }};

View file

@ -115,8 +115,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
ImmutableList.of( ImmutableList.of(
new NullInput<>(), new NullInput<>(),
createChildEntityInput( createChildEntityInput(
ImmutableSet.<Class<? extends DomainResource>>of(DomainResource.class), ImmutableSet.of(DomainResource.class), ImmutableSet.of(Recurring.class))))));
ImmutableSet.<Class<? extends Recurring>>of(Recurring.class))))));
} }
/** Mapper to expand {@link Recurring} billing events into synthetic {@link OneTime} events. */ /** Mapper to expand {@link Recurring} billing events into synthetic {@link OneTime} events. */

View file

@ -211,7 +211,7 @@ public class MapreduceEntityCleanupAction implements Runnable {
private String requestDeletion(Set<String> actualJobIds, boolean verbose) { private String requestDeletion(Set<String> actualJobIds, boolean verbose) {
Optional<StringBuilder> payloadChunkBuilder = Optional<StringBuilder> payloadChunkBuilder =
verbose ? Optional.of(new StringBuilder()) : Optional.<StringBuilder>empty(); verbose ? Optional.of(new StringBuilder()) : Optional.empty();
int errorCount = 0; int errorCount = 0;
for (String actualJobId : actualJobIds) { for (String actualJobId : actualJobIds) {
Optional<String> error = Optional<String> error =

View file

@ -92,7 +92,7 @@ class MapreduceEntityCleanupUtil {
boolean ignoreState, boolean ignoreState,
Optional<String> cursor) { Optional<String> cursor) {
if (maxJobs.isPresent() && (maxJobs.get() <= 0)) { if (maxJobs.isPresent() && (maxJobs.get() <= 0)) {
return EligibleJobResults.create(ImmutableSet.<String>of(), Optional.empty()); return EligibleJobResults.create(ImmutableSet.of(), Optional.empty());
} }
Set<String> eligibleJobs = new HashSet<>(); Set<String> eligibleJobs = new HashSet<>();
Pair<? extends Iterable<JobRecord>, String> pair = Pair<? extends Iterable<JobRecord>, String> pair =
@ -185,7 +185,7 @@ class MapreduceEntityCleanupUtil {
private ImmutableSet<String> getPossibleIdsForPipelineJobRecur( private ImmutableSet<String> getPossibleIdsForPipelineJobRecur(
BaseDatastoreService datastore, String jobId, Set<String> handledJobIds) { BaseDatastoreService datastore, String jobId, Set<String> handledJobIds) {
if (handledJobIds.contains(jobId)) { if (handledJobIds.contains(jobId)) {
return ImmutableSet.<String>of(); return ImmutableSet.of();
} }
handledJobIds.add(jobId); handledJobIds.add(jobId);
@ -193,7 +193,7 @@ class MapreduceEntityCleanupUtil {
try { try {
jobRecord = PipelineManager.getJob(jobId); jobRecord = PipelineManager.getJob(jobId);
} catch (NoSuchObjectException e) { } catch (NoSuchObjectException e) {
return ImmutableSet.<String>of(); return ImmutableSet.of();
} }
ImmutableSet.Builder<String> idSetBuilder = new ImmutableSet.Builder<>(); ImmutableSet.Builder<String> idSetBuilder = new ImmutableSet.Builder<>();

View file

@ -102,7 +102,7 @@ public class VerifyEntityIntegrityAction implements Runnable {
@VisibleForTesting @VisibleForTesting
static BatchComponent component = DaggerBatchComponent.create(); static BatchComponent component = DaggerBatchComponent.create();
private static final ImmutableSet<Class<?>> RESOURCE_CLASSES = private static final ImmutableSet<Class<?>> RESOURCE_CLASSES =
ImmutableSet.<Class<?>>of( ImmutableSet.of(
ForeignKeyDomainIndex.class, ForeignKeyDomainIndex.class,
DomainApplicationIndex.class, DomainApplicationIndex.class,
ForeignKeyHostIndex.class, ForeignKeyHostIndex.class,
@ -307,7 +307,7 @@ public class VerifyEntityIntegrityAction implements Runnable {
} }
private void mapForeignKeyIndex(ForeignKeyIndex<?> fki) { private void mapForeignKeyIndex(ForeignKeyIndex<?> fki) {
Key<ForeignKeyIndex<?>> fkiKey = Key.<ForeignKeyIndex<?>>create(fki); Key<ForeignKeyIndex<?>> fkiKey = Key.create(fki);
@SuppressWarnings("cast") @SuppressWarnings("cast")
EppResource resource = verifyExistence(fkiKey, fki.getResourceKey()); EppResource resource = verifyExistence(fkiKey, fki.getResourceKey());
if (resource != null) { if (resource != null) {
@ -368,7 +368,7 @@ public class VerifyEntityIntegrityAction implements Runnable {
private <E> void verifyExistence(Key<?> source, Set<Key<E>> targets) { private <E> void verifyExistence(Key<?> source, Set<Key<E>> targets) {
Set<Key<E>> missingEntityKeys = Set<Key<E>> missingEntityKeys =
Sets.difference(targets, ofy().load().<E>keys(targets).keySet()); Sets.difference(targets, ofy().load().keys(targets).keySet());
integrity().checkOneToMany( integrity().checkOneToMany(
missingEntityKeys.isEmpty(), missingEntityKeys.isEmpty(),
source, source,

View file

@ -118,11 +118,11 @@ public final class TldFanoutAction implements Runnable {
Set<String> tlds = Set<String> tlds =
difference( difference(
Streams.concat( Streams.concat(
Streams.stream(runInEmpty ? ImmutableSet.of("") : ImmutableSet.<String>of()), Streams.stream(runInEmpty ? ImmutableSet.of("") : ImmutableSet.of()),
Streams.stream( Streams.stream(
forEachRealTld ? getTldsOfType(REAL) : ImmutableSet.<String>of()), forEachRealTld ? getTldsOfType(REAL) : ImmutableSet.of()),
Streams.stream( Streams.stream(
forEachTestTld ? getTldsOfType(TEST) : ImmutableSet.<String>of())) forEachTestTld ? getTldsOfType(TEST) : ImmutableSet.of()))
.collect(toImmutableSet()), .collect(toImmutableSet()),
excludes); excludes);
Multimap<String, String> flowThruParams = filterKeys(params, not(in(CONTROL_PARAMS))); Multimap<String, String> flowThruParams = filterKeys(params, not(in(CONTROL_PARAMS)));

View file

@ -121,7 +121,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
// desiredRecordsBuilder is populated with an empty set to indicate that all existing records // desiredRecordsBuilder is populated with an empty set to indicate that all existing records
// should be deleted. // should be deleted.
if (!domainResource.isPresent() || !domainResource.get().shouldPublishToDns()) { if (!domainResource.isPresent() || !domainResource.get().shouldPublishToDns()) {
desiredRecords.put(absoluteDomainName, ImmutableSet.<ResourceRecordSet>of()); desiredRecords.put(absoluteDomainName, ImmutableSet.of());
return; return;
} }
@ -189,7 +189,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
// Return early if the host is deleted. // Return early if the host is deleted.
if (!host.isPresent()) { if (!host.isPresent()) {
desiredRecords.put(absoluteHostName, ImmutableSet.<ResourceRecordSet>of()); desiredRecords.put(absoluteHostName, ImmutableSet.of());
return; return;
} }

View file

@ -203,7 +203,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
union( union(
domain.getSubordinateHosts(), domain.getSubordinateHosts(),
(additionalHost == null (additionalHost == null
? ImmutableSet.<String>of() ? ImmutableSet.of()
: ImmutableSet.of(additionalHost)))) { : ImmutableSet.of(additionalHost)))) {
update.delete(toAbsoluteName(hostName), Type.ANY); update.delete(toAbsoluteName(hostName), Type.ANY);
} }

View file

@ -109,7 +109,7 @@ public final class PublishDetailReportAction implements Runnable, JsonAction {
driveFolderId, driveFolderId,
gcsBucketName, gcsBucketName,
gcsObjectName); gcsObjectName);
return ImmutableMap.<String, Object>of("driveId", driveId); return ImmutableMap.of("driveId", driveId);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new IllegalArgumentException(e.getMessage(), e); throw new IllegalArgumentException(e.getMessage(), e);
} }

View file

@ -134,7 +134,7 @@ public final class SyncGroupMembersAction implements Runnable {
for (final Registrar registrar : dirtyRegistrars) { for (final Registrar registrar : dirtyRegistrars) {
try { try {
retrier.callWithRetry(() -> syncRegistrarContacts(registrar), RuntimeException.class); retrier.callWithRetry(() -> syncRegistrarContacts(registrar), RuntimeException.class);
resultsBuilder.put(registrar, Optional.<Throwable>empty()); resultsBuilder.put(registrar, Optional.empty());
} catch (Throwable e) { } catch (Throwable e) {
logger.severe(e, e.getMessage()); logger.severe(e, e.getMessage());
resultsBuilder.put(registrar, Optional.of(e)); resultsBuilder.put(registrar, Optional.of(e));

View file

@ -144,9 +144,7 @@ public class CheckApiAction implements Runnable {
} }
private Map<String, Object> fail(String reason) { private Map<String, Object> fail(String reason) {
return ImmutableMap.<String, Object>of( return ImmutableMap.of("status", "error", "reason", reason);
"status", "error",
"reason", reason);
} }
/** Dagger module for the check api endpoint. */ /** Dagger module for the check api endpoint. */

View file

@ -108,7 +108,7 @@ public class FlowReporter {
private static final Optional<String> extractTld(String domainName) { private static final Optional<String> extractTld(String domainName) {
int index = domainName.indexOf('.'); int index = domainName.indexOf('.');
return index == -1 return index == -1
? Optional.<String>empty() ? Optional.empty()
: Optional.of(Ascii.toLowerCase(domainName.substring(index + 1))); : Optional.of(Ascii.toLowerCase(domainName.substring(index + 1)));
} }

View file

@ -251,7 +251,7 @@ public final class ResourceFlowUtils {
B extends Builder<R, B> & BuilderWithTransferData<B>> B extends Builder<R, B> & BuilderWithTransferData<B>>
R approvePendingTransfer(R resource, TransferStatus transferStatus, DateTime now) { R approvePendingTransfer(R resource, TransferStatus transferStatus, DateTime now) {
checkArgument(transferStatus.isApproved(), "Not an approval transfer status"); checkArgument(transferStatus.isApproved(), "Not an approval transfer status");
B builder = ResourceFlowUtils.<R, B>resolvePendingTransfer(resource, transferStatus, now); B builder = ResourceFlowUtils.resolvePendingTransfer(resource, transferStatus, now);
return builder return builder
.setLastTransferTime(now) .setLastTransferTime(now)
.setPersistedCurrentSponsorClientId(resource.getTransferData().getGainingClientId()) .setPersistedCurrentSponsorClientId(resource.getTransferData().getGainingClientId())

View file

@ -128,7 +128,7 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
TransferData pendingTransferData = serverApproveTransferData.asBuilder() TransferData pendingTransferData = serverApproveTransferData.asBuilder()
.setTransferStatus(TransferStatus.PENDING) .setTransferStatus(TransferStatus.PENDING)
.setServerApproveEntities( .setServerApproveEntities(
ImmutableSet.<Key<? extends TransferData.TransferServerApproveEntity>>of( ImmutableSet.of(
Key.create(serverApproveGainingPollMessage), Key.create(serverApproveGainingPollMessage),
Key.create(serverApproveLosingPollMessage))) Key.create(serverApproveLosingPollMessage)))
.build(); .build();

View file

@ -31,8 +31,8 @@ public abstract class EntityChanges {
// Default both entities to save and entities to delete to empty sets, so that the build() // Default both entities to save and entities to delete to empty sets, so that the build()
// method won't subsequently throw an exception if one doesn't end up being applicable. // method won't subsequently throw an exception if one doesn't end up being applicable.
return new AutoValue_EntityChanges.Builder() return new AutoValue_EntityChanges.Builder()
.setSaves(ImmutableSet.<ImmutableObject>of()) .setSaves(ImmutableSet.of())
.setDeletes(ImmutableSet.<Key<ImmutableObject>>of()); .setDeletes(ImmutableSet.of());
} }
/** Builder for {@link EntityChanges}. */ /** Builder for {@link EntityChanges}. */

View file

@ -184,7 +184,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
// Names on the collision list will not be delegated. Set server hold. // Names on the collision list will not be delegated. Set server hold.
.setStatusValues(getReservationTypes(domainName).contains(ReservationType.NAME_COLLISION) .setStatusValues(getReservationTypes(domainName).contains(ReservationType.NAME_COLLISION)
? ImmutableSet.of(StatusValue.SERVER_HOLD) ? ImmutableSet.of(StatusValue.SERVER_HOLD)
: ImmutableSet.<StatusValue>of()) : ImmutableSet.of())
.setRegistrant(command.getRegistrant()) .setRegistrant(command.getRegistrant())
.setAuthInfo(command.getAuthInfo()) .setAuthInfo(command.getAuthInfo())
.setFullyQualifiedDomainName(targetId) .setFullyQualifiedDomainName(targetId)
@ -405,7 +405,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
FeeCreateCommandExtension feeCreate = FeeCreateCommandExtension feeCreate =
eppInput.getSingleExtension(FeeCreateCommandExtension.class); eppInput.getSingleExtension(FeeCreateCommandExtension.class);
return (feeCreate == null) return (feeCreate == null)
? ImmutableList.<FeeTransformResponseExtension>of() ? ImmutableList.of()
: ImmutableList.of(createFeeCreateResponse(feeCreate, feesAndCredits)); : ImmutableList.of(createFeeCreateResponse(feeCreate, feesAndCredits));
} }

View file

@ -187,7 +187,7 @@ public final class DomainCheckFlow implements Flow {
} }
return reservationTypes.isEmpty() return reservationTypes.isEmpty()
? Optional.<String>empty() ? Optional.empty()
: Optional.of(getTypeOfHighestSeverity(reservationTypes).getMessageForCheck()); : Optional.of(getTypeOfHighestSeverity(reservationTypes).getMessageForCheck());
} }

View file

@ -86,7 +86,6 @@ import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.secdns.SecDnsCreateExtension; import google.registry.model.domain.secdns.SecDnsCreateExtension;
import google.registry.model.eppcommon.AuthInfo; import google.registry.model.eppcommon.AuthInfo;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppinput.EppInput; import google.registry.model.eppinput.EppInput;
import google.registry.model.eppinput.ResourceCommand; import google.registry.model.eppinput.ResourceCommand;
import google.registry.model.eppoutput.CreateData.DomainCreateData; import google.registry.model.eppoutput.CreateData.DomainCreateData;
@ -305,7 +304,7 @@ public class DomainCreateFlow implements TransactionalFlow {
.setStatusValues( .setStatusValues(
registry.getDomainCreateRestricted() registry.getDomainCreateRestricted()
? ImmutableSet.of(SERVER_UPDATE_PROHIBITED, SERVER_TRANSFER_PROHIBITED) ? ImmutableSet.of(SERVER_UPDATE_PROHIBITED, SERVER_TRANSFER_PROHIBITED)
: ImmutableSet.<StatusValue>of()) : ImmutableSet.of())
.setContacts(command.getContacts()) .setContacts(command.getContacts())
.addGracePeriod(GracePeriod.forBillingEvent(GracePeriodStatus.ADD, createBillingEvent)) .addGracePeriod(GracePeriod.forBillingEvent(GracePeriodStatus.ADD, createBillingEvent))
.build(); .build();
@ -411,7 +410,7 @@ public class DomainCreateFlow implements TransactionalFlow {
.setFlags( .setFlags(
isAnchorTenant isAnchorTenant
? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT) ? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT)
: ImmutableSet.<BillingEvent.Flag>of()) : ImmutableSet.of())
.setParent(historyEntry) .setParent(historyEntry)
.build(); .build();
} }
@ -471,7 +470,7 @@ public class DomainCreateFlow implements TransactionalFlow {
private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
FeeCreateCommandExtension feeCreate, FeesAndCredits feesAndCredits) { FeeCreateCommandExtension feeCreate, FeesAndCredits feesAndCredits) {
return (feeCreate == null) return (feeCreate == null)
? ImmutableList.<FeeTransformResponseExtension>of() ? ImmutableList.of()
: ImmutableList.of(createFeeCreateResponse(feeCreate, feesAndCredits)); : ImmutableList.of(createFeeCreateResponse(feeCreate, feesAndCredits));
} }

View file

@ -503,7 +503,7 @@ public class DomainFlowUtils {
: newAutorenewPollMessage(domain) : newAutorenewPollMessage(domain)
.setId(existingAutorenewKey.getId()) .setId(existingAutorenewKey.getId())
.setAutorenewEndTime(newEndTime) .setAutorenewEndTime(newEndTime)
.setParentKey(existingAutorenewKey.<HistoryEntry>getParent()) .setParentKey(existingAutorenewKey.getParent())
.build(); .build();
// If the resultant autorenew poll message would have no poll messages to deliver, then just // If the resultant autorenew poll message would have no poll messages to deliver, then just
@ -734,10 +734,10 @@ public class DomainFlowUtils {
throw new SecDnsAllUsageException(); // Explicit all=false is meaningless. throw new SecDnsAllUsageException(); // Explicit all=false is meaningless.
} }
Set<DelegationSignerData> toAdd = (add == null) Set<DelegationSignerData> toAdd = (add == null)
? ImmutableSet.<DelegationSignerData>of() ? ImmutableSet.of()
: add.getDsData(); : add.getDsData();
Set<DelegationSignerData> toRemove = (remove == null) Set<DelegationSignerData> toRemove = (remove == null)
? ImmutableSet.<DelegationSignerData>of() ? ImmutableSet.of()
: (remove.getAll() == null) ? remove.getDsData() : oldDsData; : (remove.getAll() == null) ? remove.getDsData() : oldDsData;
// RFC 5910 specifies that removes are processed before adds. // RFC 5910 specifies that removes are processed before adds.
return ImmutableSet.copyOf(union(difference(oldDsData, toRemove), toAdd)); return ImmutableSet.copyOf(union(difference(oldDsData, toRemove), toAdd));

View file

@ -210,6 +210,6 @@ public final class DomainPricingLogic {
return Optional.of(token); return Optional.of(token);
} }
} }
return Optional.<LrpTokenEntity>empty(); return Optional.empty();
} }
} }

View file

@ -47,7 +47,6 @@ import google.registry.flows.custom.DomainRenewFlowCustomLogic.BeforeResponsePar
import google.registry.flows.custom.DomainRenewFlowCustomLogic.BeforeResponseReturnData; import google.registry.flows.custom.DomainRenewFlowCustomLogic.BeforeResponseReturnData;
import google.registry.flows.custom.DomainRenewFlowCustomLogic.BeforeSaveParameters; import google.registry.flows.custom.DomainRenewFlowCustomLogic.BeforeSaveParameters;
import google.registry.flows.custom.EntityChanges; import google.registry.flows.custom.EntityChanges;
import google.registry.model.ImmutableObject;
import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.OneTime;
import google.registry.model.billing.BillingEvent.Reason; import google.registry.model.billing.BillingEvent.Reason;
@ -189,7 +188,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
.setEntityChanges( .setEntityChanges(
EntityChanges.newBuilder() EntityChanges.newBuilder()
.setSaves( .setSaves(
ImmutableSet.<ImmutableObject>of( ImmutableSet.of(
newDomain, newDomain,
historyEntry, historyEntry,
explicitRenewEvent, explicitRenewEvent,
@ -264,7 +263,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
private ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
Money renewCost, FeeRenewCommandExtension feeRenew) { Money renewCost, FeeRenewCommandExtension feeRenew) {
return (feeRenew == null) return (feeRenew == null)
? ImmutableList.<FeeTransformResponseExtension>of() ? ImmutableList.of()
: ImmutableList.of(feeRenew.createResponseBuilder() : ImmutableList.of(feeRenew.createResponseBuilder()
.setCurrency(renewCost.getCurrencyUnit()) .setCurrency(renewCost.getCurrencyUnit())
.setFees(ImmutableList.of(Fee.create(renewCost.getAmount(), FeeType.RENEW))) .setFees(ImmutableList.of(Fee.create(renewCost.getAmount(), FeeType.RENEW)))

View file

@ -263,7 +263,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
Money restoreCost, Money renewCost, FeeUpdateCommandExtension feeUpdate) { Money restoreCost, Money renewCost, FeeUpdateCommandExtension feeUpdate) {
return (feeUpdate == null) return (feeUpdate == null)
? ImmutableList.<FeeTransformResponseExtension>of() ? ImmutableList.of()
: ImmutableList.of(feeUpdate.createResponseBuilder() : ImmutableList.of(feeUpdate.createResponseBuilder()
.setCurrency(restoreCost.getCurrencyUnit()) .setCurrency(restoreCost.getCurrencyUnit())
.setFees(ImmutableList.of( .setFees(ImmutableList.of(

View file

@ -119,7 +119,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
// the transfer period to zero. There is not a transfer cost if the transfer period is zero. // the transfer period to zero. There is not a transfer cost if the transfer period is zero.
Optional<BillingEvent.OneTime> billingEvent = Optional<BillingEvent.OneTime> billingEvent =
(transferData.getTransferPeriod().getValue() == 0) (transferData.getTransferPeriod().getValue() == 0)
? Optional.<BillingEvent.OneTime>empty() ? Optional.empty()
: Optional.of( : Optional.of(
new BillingEvent.OneTime.Builder() new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER) .setReason(Reason.TRANSFER)
@ -192,7 +192,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
(billingEvent.isPresent()) (billingEvent.isPresent())
? ImmutableSet.of( ? ImmutableSet.of(
GracePeriod.forBillingEvent(GracePeriodStatus.TRANSFER, billingEvent.get())) GracePeriod.forBillingEvent(GracePeriodStatus.TRANSFER, billingEvent.get()))
: ImmutableSet.<GracePeriod>of()) : ImmutableSet.of())
.build(); .build();
// Create a poll message for the gaining client. // Create a poll message for the gaining client.
PollMessage gainingClientPollMessage = createGainingTransferPollMessage( PollMessage gainingClientPollMessage = createGainingTransferPollMessage(

View file

@ -73,7 +73,6 @@ import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import java.util.Optional; import java.util.Optional;
import javax.inject.Inject; import javax.inject.Inject;
import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** /**
@ -160,7 +159,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
// If the period is zero, then there is no fee for the transfer. // If the period is zero, then there is no fee for the transfer.
Optional<FeesAndCredits> feesAndCredits = Optional<FeesAndCredits> feesAndCredits =
(period.getValue() == 0) (period.getValue() == 0)
? Optional.<FeesAndCredits>empty() ? Optional.empty()
: Optional.of(pricingLogic.getTransferPrice(registry, targetId, now)); : Optional.of(pricingLogic.getTransferPrice(registry, targetId, now));
if (feesAndCredits.isPresent()) { if (feesAndCredits.isPresent()) {
validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits.get()); validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits.get());
@ -200,7 +199,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
gainingClientId, gainingClientId,
(feesAndCredits.isPresent()) (feesAndCredits.isPresent())
? Optional.of(feesAndCredits.get().getTotalCost()) ? Optional.of(feesAndCredits.get().getTotalCost())
: Optional.<Money>empty(), : Optional.empty(),
now); now);
// Create the transfer data that represents the pending transfer. // Create the transfer data that represents the pending transfer.
TransferData pendingTransferData = TransferData pendingTransferData =
@ -337,7 +336,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
Optional<FeesAndCredits> feesAndCredits, FeeTransferCommandExtension feeTransfer) { Optional<FeesAndCredits> feesAndCredits, FeeTransferCommandExtension feeTransfer) {
return (feeTransfer == null || !feesAndCredits.isPresent()) return (feeTransfer == null || !feesAndCredits.isPresent())
? ImmutableList.<FeeTransformResponseExtension>of() ? ImmutableList.of()
: ImmutableList.of(feeTransfer.createResponseBuilder() : ImmutableList.of(feeTransfer.createResponseBuilder()
.setFees(feesAndCredits.get().getFees()) .setFees(feesAndCredits.get().getFees())
.setCredits(feesAndCredits.get().getCredits()) .setCredits(feesAndCredits.get().getCredits())

View file

@ -121,7 +121,7 @@ public class FlowPicker {
/** Session flows like login and logout are keyed only on the {@link InnerCommand} type. */ /** Session flows like login and logout are keyed only on the {@link InnerCommand} type. */
private static final FlowProvider SESSION_FLOW_PROVIDER = new FlowProvider() { private static final FlowProvider SESSION_FLOW_PROVIDER = new FlowProvider() {
private final Map<Class<?>, Class<? extends Flow>> commandFlows = private final Map<Class<?>, Class<? extends Flow>> commandFlows =
ImmutableMap.<Class<?>, Class<? extends Flow>>of( ImmutableMap.of(
Login.class, LoginFlow.class, Login.class, LoginFlow.class,
Logout.class, LogoutFlow.class); Logout.class, LogoutFlow.class);
@ -240,7 +240,7 @@ public class FlowPicker {
private static final FlowProvider APPLICATION_CRUD_FLOW_PROVIDER = new FlowProvider() { private static final FlowProvider APPLICATION_CRUD_FLOW_PROVIDER = new FlowProvider() {
private final Map<Class<? extends ResourceCommand>, Class<? extends Flow>> applicationFlows = private final Map<Class<? extends ResourceCommand>, Class<? extends Flow>> applicationFlows =
ImmutableMap.<Class<? extends ResourceCommand>, Class<? extends Flow>>of( ImmutableMap.of(
DomainCommand.Create.class, DomainApplicationCreateFlow.class, DomainCommand.Create.class, DomainApplicationCreateFlow.class,
DomainCommand.Delete.class, DomainApplicationDeleteFlow.class, DomainCommand.Delete.class, DomainApplicationDeleteFlow.class,
DomainCommand.Info.class, DomainApplicationInfoFlow.class, DomainCommand.Info.class, DomainApplicationInfoFlow.class,

View file

@ -203,8 +203,8 @@ public class MapreduceRunner {
.setMapper(mapper) .setMapper(mapper)
.setReducer(reducer) .setReducer(reducer)
.setOutput(output) .setOutput(output)
.setKeyMarshaller(Marshallers.<K>getSerializationMarshaller()) .setKeyMarshaller(Marshallers.getSerializationMarshaller())
.setValueMarshaller(Marshallers.<V>getSerializationMarshaller()) .setValueMarshaller(Marshallers.getSerializationMarshaller())
.setNumReducers(httpParamReduceShards.orElse(defaultReduceShards)) .setNumReducers(httpParamReduceShards.orElse(defaultReduceShards))
.build(), .build(),
new MapReduceSettings.Builder() new MapReduceSettings.Builder()

View file

@ -41,8 +41,8 @@ class ChildEntityInput<R extends EppResource, I extends ImmutableObject>
ImmutableSet<Class<? extends I>> childResourceClasses) { ImmutableSet<Class<? extends I>> childResourceClasses) {
this.resourceClasses = resourceClasses; this.resourceClasses = resourceClasses;
this.childResourceClasses = childResourceClasses; this.childResourceClasses = childResourceClasses;
checkNoInheritanceRelationships(ImmutableSet.<Class<?>>copyOf(resourceClasses)); checkNoInheritanceRelationships(ImmutableSet.copyOf(resourceClasses));
checkNoInheritanceRelationships(ImmutableSet.<Class<?>>copyOf(childResourceClasses)); checkNoInheritanceRelationships(ImmutableSet.copyOf(childResourceClasses));
} }
@Override @Override

View file

@ -137,7 +137,7 @@ abstract class EppResourceBaseReader<T> extends InputReader<T> {
ImmutableSet<Class<? extends R>> resourceClasses) { ImmutableSet<Class<? extends R>> resourceClasses) {
// Ignore EppResource when finding kinds, since it doesn't have one and doesn't imply filtering. // Ignore EppResource when finding kinds, since it doesn't have one and doesn't imply filtering.
return resourceClasses.contains(EppResource.class) return resourceClasses.contains(EppResource.class)
? ImmutableSet.<String>of() ? ImmutableSet.of()
: resourceClasses.stream().map(CLASS_TO_KIND_FUNCTION).collect(toImmutableSet()); : resourceClasses.stream().map(CLASS_TO_KIND_FUNCTION).collect(toImmutableSet());
} }
} }

View file

@ -32,7 +32,7 @@ class EppResourceEntityInput<R extends EppResource> extends EppResourceBaseInput
public EppResourceEntityInput(ImmutableSet<Class<? extends R>> resourceClasses) { public EppResourceEntityInput(ImmutableSet<Class<? extends R>> resourceClasses) {
this.resourceClasses = resourceClasses; this.resourceClasses = resourceClasses;
checkNoInheritanceRelationships(ImmutableSet.<Class<?>>copyOf(resourceClasses)); checkNoInheritanceRelationships(ImmutableSet.copyOf(resourceClasses));
} }
@Override @Override

View file

@ -29,7 +29,7 @@ class EppResourceIndexReader extends EppResourceBaseReader<EppResourceIndex> {
public EppResourceIndexReader(Key<EppResourceIndexBucket> bucketKey) { public EppResourceIndexReader(Key<EppResourceIndexBucket> bucketKey) {
// Estimate 1MB of memory for this reader, which is massive overkill. // Estimate 1MB of memory for this reader, which is massive overkill.
// Use an empty set for the filter kinds, which disables filtering. // Use an empty set for the filter kinds, which disables filtering.
super(bucketKey, ONE_MB, ImmutableSet.<String>of()); super(bucketKey, ONE_MB, ImmutableSet.of());
} }
/** /**

View file

@ -36,7 +36,7 @@ class EppResourceKeyInput<R extends EppResource> extends EppResourceBaseInput<Ke
public EppResourceKeyInput(ImmutableSet<Class<? extends R>> resourceClasses) { public EppResourceKeyInput(ImmutableSet<Class<? extends R>> resourceClasses) {
this.resourceClasses = resourceClasses; this.resourceClasses = resourceClasses;
checkNoInheritanceRelationships(ImmutableSet.<Class<?>>copyOf(resourceClasses)); checkNoInheritanceRelationships(ImmutableSet.copyOf(resourceClasses));
} }
@Override @Override

View file

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

View file

@ -164,7 +164,7 @@ public final class EppResourceUtils {
ofy().load().type(clazz) ofy().load().type(clazz)
.filter(filterDefinition, filterValue) .filter(filterDefinition, filterValue)
.filter("deletionTime >", now.toDate()), .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( private Optional<Money> getMostRecentlyWrittenBalance(
Map.Entry<DateTime, ImmutableSortedMap<DateTime, Money>> balancesAtEffectiveTime) { Map.Entry<DateTime, ImmutableSortedMap<DateTime, Money>> balancesAtEffectiveTime) {
return balancesAtEffectiveTime == null 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. // Don't use Optional.ofNullable() here since it's an error if there's a empty submap.
: Optional.of(balancesAtEffectiveTime.getValue().lastEntry().getValue()); : 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); Map<DateTime, V> newInnerMap = new HashMap<>(currentMap);
newInnerMap.put(transitionTime, transitionValue); newInnerMap.put(transitionTime, transitionValue);
ImmutableSortedMap<DateTime, V> newMap = ImmutableSortedMap<DateTime, V> newMap =
ImmutableSortedMap.<DateTime, V>copyOf(newInnerMap); ImmutableSortedMap.copyOf(newInnerMap);
validateTimedTransitionMap(newMap, allowedTransitions, allowedTransitionMapName); validateTimedTransitionMap(newMap, allowedTransitions, allowedTransitionMapName);
return fromValueMap(newMap, transitionClass); return fromValueMap(newMap, transitionClass);
} }

View file

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

View file

@ -131,7 +131,7 @@ public class EppInput extends ImmutableObject {
ResourceCommand resourceCommand = getResourceCommand(); ResourceCommand resourceCommand = getResourceCommand();
return resourceCommand instanceof SingleResourceCommand return resourceCommand instanceof SingleResourceCommand
? Optional.of(((SingleResourceCommand) resourceCommand).getTargetId()) ? 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) { public static DomainApplicationIndex createUpdatedInstance(DomainApplication application) {
DomainApplicationIndex existing = load(application.getFullyQualifiedDomainName()); DomainApplicationIndex existing = load(application.getFullyQualifiedDomainName());
ImmutableSet<Key<DomainApplication>> newKeys = CollectionUtils.union( ImmutableSet<Key<DomainApplication>> newKeys = CollectionUtils.union(
(existing == null ? ImmutableSet.<Key<DomainApplication>>of() : existing.getKeys()), (existing == null ? ImmutableSet.of() : existing.getKeys()),
Key.create(application)); Key.create(application));
return createWithSpecifiedKeys(application.getFullyQualifiedDomainName(), newKeys); return createWithSpecifiedKeys(application.getFullyQualifiedDomainName(), newKeys);
} }

View file

@ -59,7 +59,7 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
static final ImmutableMap< static final ImmutableMap<
Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>> Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>
RESOURCE_CLASS_TO_FKI_CLASS = RESOURCE_CLASS_TO_FKI_CLASS =
ImmutableMap.<Class<? extends EppResource>, Class<? extends ForeignKeyIndex<?>>>of( ImmutableMap.of(
ContactResource.class, ForeignKeyContactIndex.class, ContactResource.class, ForeignKeyContactIndex.class,
DomainResource.class, ForeignKeyDomainIndex.class, DomainResource.class, ForeignKeyDomainIndex.class,
HostResource.class, ForeignKeyHostIndex.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) { public static <E extends EppResource> Key<ForeignKeyIndex<E>> createKey(E resource) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<E> resourceClass = (Class<E>) resource.getClass(); 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 @Override
public Result<Void> entity(Object entity) { public Result<Void> entity(Object entity) {
handleDeletion(Arrays.<Key<?>>asList(Key.create(entity))); handleDeletion(Arrays.asList(Key.create(entity)));
return delegate.entity(entity); return delegate.entity(entity);
} }
@Override @Override
public Result<Void> key(Key<?> key) { public Result<Void> key(Key<?> key) {
handleDeletion(Arrays.<Key<?>>asList(key)); handleDeletion(Arrays.asList(key));
return delegate.keys(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. */ /** Metadata for an {@link Ofy} transaction that saves commit logs. */
class TransactionInfo { 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 } private enum Delete { SENTINEL }

View file

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

View file

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

View file

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

View file

@ -29,7 +29,7 @@ final class MetricMetrics {
"/metrics/push_intervals", "/metrics/push_intervals",
"Count of push intervals.", "Count of push intervals.",
"Push Intervals", "Push Intervals",
ImmutableSet.<LabelDescriptor>of()); ImmutableSet.of());
private static final ImmutableSet<LabelDescriptor> LABELS = private static final ImmutableSet<LabelDescriptor> LABELS =
ImmutableSet.of( ImmutableSet.of(
LabelDescriptor.create("kind", "Metric Kind"), LabelDescriptor.create("kind", "Metric Kind"),

View file

@ -117,7 +117,7 @@ public class MetricReporter extends AbstractScheduledService {
runOneIteration(); runOneIteration();
// Offer a poision pill to inform the exporter to stop. // Offer a poision pill to inform the exporter to stop.
writeQueue.offer(Optional.<ImmutableList<MetricPoint<?>>>empty()); writeQueue.offer(Optional.empty());
try { try {
metricExporter.awaitTerminated(10, TimeUnit.SECONDS); metricExporter.awaitTerminated(10, TimeUnit.SECONDS);
logger.info("Shut down MetricExporter"); logger.info("Shut down MetricExporter");

View file

@ -382,7 +382,7 @@ public class StackdriverWriter implements MetricWriter {
List<LabelDescriptor> encodedLabels = descriptor.getLabels(); List<LabelDescriptor> encodedLabels = descriptor.getLabels();
// The MetricDescriptors returned by the GCM API have null fields rather than empty lists // The MetricDescriptors returned by the GCM API have null fields rather than empty lists
encodedLabels = encodedLabels == null ? ImmutableList.<LabelDescriptor>of() : encodedLabels; encodedLabels = encodedLabels == null ? ImmutableList.of() : encodedLabels;
ImmutableMap.Builder<String, String> labelValues = new ImmutableMap.Builder<>(); ImmutableMap.Builder<String, String> labelValues = new ImmutableMap.Builder<>();
int i = 0; int i = 0;

View file

@ -178,7 +178,7 @@ public abstract class EppMetric implements BigQueryMetric {
public Builder setTlds(ImmutableSet<String> tlds) { public Builder setTlds(ImmutableSet<String> tlds) {
switch (tlds.size()) { switch (tlds.size()) {
case 0: case 0:
setTld(Optional.<String>empty()); setTld(Optional.empty());
break; break;
case 1: case 1:
String tld = Iterables.getOnlyElement(tlds); String tld = Iterables.getOnlyElement(tlds);

View file

@ -67,7 +67,7 @@ public class MetricsExportAction implements Runnable {
// Filter out the special parameters that the Action is called with. Everything that's left // Filter out the special parameters that the Action is called with. Everything that's left
// is returned in a Map that is suitable to pass to Bigquery as row data. // is returned in a Map that is suitable to pass to Bigquery as row data.
Map<String, Object> jsonRows = Map<String, Object> jsonRows =
ImmutableMap.<String, Object>copyOf( ImmutableMap.copyOf(
filterKeys(parameters, not(in(SPECIAL_PARAMS))).entries()); filterKeys(parameters, not(in(SPECIAL_PARAMS))).entries());
TableDataInsertAllResponse response = bigquery.tabledata() TableDataInsertAllResponse response = bigquery.tabledata()
.insertAll( .insertAll(

View file

@ -54,9 +54,9 @@ public abstract class RdapAuthorization extends ImmutableObject {
} }
public static final RdapAuthorization PUBLIC_AUTHORIZATION = public static final RdapAuthorization PUBLIC_AUTHORIZATION =
create(Role.PUBLIC, ImmutableList.<String>of()); create(Role.PUBLIC, ImmutableList.of());
public static final RdapAuthorization ADMINISTRATOR_AUTHORIZATION = public static final RdapAuthorization ADMINISTRATOR_AUTHORIZATION =
create(Role.ADMINISTRATOR, ImmutableList.<String>of()); create(Role.ADMINISTRATOR, ImmutableList.of());
} }

View file

@ -156,7 +156,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
builder, builder,
BoilerplateType.DOMAIN, BoilerplateType.DOMAIN,
results.getIncompletenessWarnings(), results.getIncompletenessWarnings(),
ImmutableList.<ImmutableMap<String, Object>>of(), ImmutableList.of(),
fullServletPath); fullServletPath);
return builder.build(); return builder.build();
} }
@ -210,7 +210,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
loadByForeignKey(DomainResource.class, partialStringQuery.getInitialString(), now); loadByForeignKey(DomainResource.class, partialStringQuery.getInitialString(), now);
ImmutableList<DomainResource> results = ImmutableList<DomainResource> results =
((domainResource == null) || !shouldBeVisible(domainResource, now)) ((domainResource == null) || !shouldBeVisible(domainResource, now))
? ImmutableList.<DomainResource>of() ? ImmutableList.of()
: ImmutableList.of(domainResource); : ImmutableList.of(domainResource);
return makeSearchResults(results, now); return makeSearchResults(results, now);
} }

View file

@ -24,7 +24,6 @@ import com.google.common.primitives.Longs;
import com.google.re2j.Pattern; import com.google.re2j.Pattern;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.model.contact.ContactResource; import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar;
import google.registry.rdap.RdapJsonFormatter.OutputDataType; import google.registry.rdap.RdapJsonFormatter.OutputDataType;
import google.registry.rdap.RdapMetrics.EndpointType; import google.registry.rdap.RdapMetrics.EndpointType;
@ -95,7 +94,7 @@ public class RdapEntityAction extends RdapActionBase {
return rdapJsonFormatter.makeRdapJsonForContact( return rdapJsonFormatter.makeRdapJsonForContact(
contactResource, contactResource,
true, true,
Optional.<DesignatedContact.Type>empty(), Optional.empty(),
fullServletPath, fullServletPath,
rdapWhoisServer, rdapWhoisServer,
now, now,

View file

@ -27,7 +27,6 @@ import com.google.common.primitives.Booleans;
import com.google.common.primitives.Longs; import com.google.common.primitives.Longs;
import com.googlecode.objectify.cmd.Query; import com.googlecode.objectify.cmd.Query;
import google.registry.model.contact.ContactResource; import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar;
import google.registry.rdap.RdapJsonFormatter.BoilerplateType; import google.registry.rdap.RdapJsonFormatter.BoilerplateType;
import google.registry.rdap.RdapJsonFormatter.OutputDataType; import google.registry.rdap.RdapJsonFormatter.OutputDataType;
@ -119,7 +118,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
jsonBuilder, jsonBuilder,
BoilerplateType.ENTITY, BoilerplateType.ENTITY,
results.getIncompletenessWarnings(), results.getIncompletenessWarnings(),
ImmutableList.<ImmutableMap<String, Object>>of(), ImmutableList.of(),
fullServletPath); fullServletPath);
return jsonBuilder.build(); return jsonBuilder.build();
} }
@ -219,7 +218,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
return makeSearchResults( return makeSearchResults(
((contactResource != null) && shouldBeVisible(contactResource, now)) ((contactResource != null) && shouldBeVisible(contactResource, now))
? ImmutableList.of(contactResource) ? ImmutableList.of(contactResource)
: ImmutableList.<ContactResource>of(), : ImmutableList.of(),
IncompletenessWarningType.NONE, IncompletenessWarningType.NONE,
getMatchingRegistrars(partialStringQuery.getInitialString()), getMatchingRegistrars(partialStringQuery.getInitialString()),
now); now);
@ -230,7 +229,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
} else { } else {
ImmutableList<Registrar> registrars = ImmutableList<Registrar> registrars =
partialStringQuery.getHasWildcard() partialStringQuery.getHasWildcard()
? ImmutableList.<Registrar>of() ? ImmutableList.of()
: getMatchingRegistrars(partialStringQuery.getInitialString()); : getMatchingRegistrars(partialStringQuery.getInitialString());
// Get the contact matches and return the results, fetching an additional contact to detect // Get the contact matches and return the results, fetching an additional contact to detect
// truncation. If we are including deleted entries, we must fetch more entries, in case some // truncation. If we are including deleted entries, we must fetch more entries, in case some
@ -257,7 +256,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
Optional<Registrar> registrar = getRegistrarByIanaIdentifier(ianaIdentifier); Optional<Registrar> registrar = getRegistrarByIanaIdentifier(ianaIdentifier);
return (registrar.isPresent() && shouldBeVisible(registrar.get())) return (registrar.isPresent() && shouldBeVisible(registrar.get()))
? ImmutableList.of(registrar.get()) ? ImmutableList.of(registrar.get())
: ImmutableList.<Registrar>of(); : ImmutableList.of();
} }
/** /**
@ -310,7 +309,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
jsonOutputList.add(rdapJsonFormatter.makeRdapJsonForContact( jsonOutputList.add(rdapJsonFormatter.makeRdapJsonForContact(
contact, contact,
false, false,
Optional.<DesignatedContact.Type>empty(), Optional.empty(),
fullServletPath, fullServletPath,
rdapWhoisServer, rdapWhoisServer,
now, now,

View file

@ -65,7 +65,7 @@ public class RdapHelpAction extends RdapActionBase {
builder, builder,
BoilerplateType.OTHER, BoilerplateType.OTHER,
ImmutableList.of(rdapJsonFormatter.getJsonHelpNotice(pathSearchString, fullServletPath)), ImmutableList.of(rdapJsonFormatter.getJsonHelpNotice(pathSearchString, fullServletPath)),
ImmutableList.<ImmutableMap<String, Object>>of(), ImmutableList.of(),
fullServletPath); fullServletPath);
return builder.build(); return builder.build();
} }

View file

@ -27,7 +27,7 @@ public class RdapIcannStandardInformation {
/** Required by ICANN RDAP Profile section 1.4.10. */ /** Required by ICANN RDAP Profile section 1.4.10. */
private static final ImmutableMap<String, Object> CONFORMANCE_REMARK = private static final ImmutableMap<String, Object> CONFORMANCE_REMARK =
ImmutableMap.<String, Object>of( ImmutableMap.of(
"description", "description",
ImmutableList.of( ImmutableList.of(
"This response conforms to the RDAP Operational Profile for gTLD Registries and" "This response conforms to the RDAP Operational Profile for gTLD Registries and"
@ -35,7 +35,7 @@ public class RdapIcannStandardInformation {
/** Required by ICANN RDAP Profile section 1.5.18. */ /** Required by ICANN RDAP Profile section 1.5.18. */
private static final ImmutableMap<String, Object> DOMAIN_STATUS_CODES_REMARK = private static final ImmutableMap<String, Object> DOMAIN_STATUS_CODES_REMARK =
ImmutableMap.<String, Object> of( ImmutableMap.of(
"title", "title",
"EPP Status Codes", "EPP Status Codes",
"description", "description",
@ -51,7 +51,7 @@ public class RdapIcannStandardInformation {
/** Required by ICANN RDAP Profile section 1.5.20. */ /** Required by ICANN RDAP Profile section 1.5.20. */
private static final ImmutableMap<String, Object> INACCURACY_COMPLAINT_FORM_REMARK = private static final ImmutableMap<String, Object> INACCURACY_COMPLAINT_FORM_REMARK =
ImmutableMap.<String, Object> of( ImmutableMap.of(
"description", "description",
ImmutableList.of( ImmutableList.of(
"URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf"), "URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf"),
@ -78,7 +78,7 @@ public class RdapIcannStandardInformation {
* @see <a href="http://mm.icann.org/pipermail/gtld-tech/2016-October/000822.html">Questions about the ICANN RDAP Profile</a> * @see <a href="http://mm.icann.org/pipermail/gtld-tech/2016-October/000822.html">Questions about the ICANN RDAP Profile</a>
*/ */
static final ImmutableMap<String, Object> SUMMARY_DATA_REMARK = static final ImmutableMap<String, Object> SUMMARY_DATA_REMARK =
ImmutableMap.<String, Object> of( ImmutableMap.of(
"title", "title",
"Incomplete Data", "Incomplete Data",
"description", "description",
@ -93,7 +93,7 @@ public class RdapIcannStandardInformation {
* @see <a href="http://mm.icann.org/pipermail/gtld-tech/2016-October/000822.html">Questions about the ICANN RDAP Profile</a> * @see <a href="http://mm.icann.org/pipermail/gtld-tech/2016-October/000822.html">Questions about the ICANN RDAP Profile</a>
*/ */
static final ImmutableMap<String, Object> TRUNCATED_RESULT_SET_NOTICE = static final ImmutableMap<String, Object> TRUNCATED_RESULT_SET_NOTICE =
ImmutableMap.<String, Object> of( ImmutableMap.of(
"title", "title",
"Search Policy", "Search Policy",
"description", "description",
@ -110,7 +110,7 @@ public class RdapIcannStandardInformation {
* there were too many nameservers in the first stage results. * there were too many nameservers in the first stage results.
*/ */
static final ImmutableMap<String, Object> POSSIBLY_INCOMPLETE_RESULT_SET_NOTICE = static final ImmutableMap<String, Object> POSSIBLY_INCOMPLETE_RESULT_SET_NOTICE =
ImmutableMap.<String, Object>of( ImmutableMap.of(
"title", "title",
"Search Policy", "Search Policy",
"description", "description",
@ -125,7 +125,7 @@ public class RdapIcannStandardInformation {
/** Included when the requester is not logged in as the owner of the domain being returned. */ /** Included when the requester is not logged in as the owner of the domain being returned. */
static final ImmutableMap<String, Object> DOMAIN_CONTACTS_HIDDEN_DATA_REMARK = static final ImmutableMap<String, Object> DOMAIN_CONTACTS_HIDDEN_DATA_REMARK =
ImmutableMap.<String, Object> of( ImmutableMap.of(
"title", "title",
"Contacts Hidden", "Contacts Hidden",
"description", "description",
@ -135,7 +135,7 @@ public class RdapIcannStandardInformation {
/** Included when requester is not logged in as the owner of the contact being returned. */ /** Included when requester is not logged in as the owner of the contact being returned. */
static final ImmutableMap<String, Object> CONTACT_PERSONAL_DATA_HIDDEN_DATA_REMARK = static final ImmutableMap<String, Object> CONTACT_PERSONAL_DATA_HIDDEN_DATA_REMARK =
ImmutableMap.<String, Object> of( ImmutableMap.of(
"title", "title",
"Contact Personal Data Hidden", "Contact Personal Data Hidden",
"description", "description",

View file

@ -482,7 +482,7 @@ public class RdapJsonFormatter {
remarks = ImmutableList.of(RdapIcannStandardInformation.SUMMARY_DATA_REMARK); remarks = ImmutableList.of(RdapIcannStandardInformation.SUMMARY_DATA_REMARK);
} else { } else {
remarks = displayContacts remarks = displayContacts
? ImmutableList.<ImmutableMap<String, Object>>of() ? ImmutableList.of()
: ImmutableList.of(RdapIcannStandardInformation.DOMAIN_CONTACTS_HIDDEN_DATA_REMARK); : ImmutableList.of(RdapIcannStandardInformation.DOMAIN_CONTACTS_HIDDEN_DATA_REMARK);
ImmutableList<Object> events = makeEvents(domainResource, now); ImmutableList<Object> events = makeEvents(domainResource, now);
if (!events.isEmpty()) { if (!events.isEmpty()) {
@ -537,7 +537,7 @@ public class RdapJsonFormatter {
jsonBuilder, jsonBuilder,
BoilerplateType.DOMAIN, BoilerplateType.DOMAIN,
remarks, remarks,
ImmutableList.<ImmutableMap<String, Object>>of(), linkBase); ImmutableList.of(), linkBase);
} else if (!remarks.isEmpty()) { } else if (!remarks.isEmpty()) {
jsonBuilder.put(REMARKS, remarks); jsonBuilder.put(REMARKS, remarks);
} }
@ -633,7 +633,7 @@ public class RdapJsonFormatter {
jsonBuilder, jsonBuilder,
BoilerplateType.NAMESERVER, BoilerplateType.NAMESERVER,
remarks, remarks,
ImmutableList.<ImmutableMap<String, Object>>of(), linkBase); ImmutableList.of(), linkBase);
} else if (!remarks.isEmpty()) { } else if (!remarks.isEmpty()) {
jsonBuilder.put(REMARKS, remarks); jsonBuilder.put(REMARKS, remarks);
} }
@ -735,7 +735,7 @@ public class RdapJsonFormatter {
jsonBuilder, jsonBuilder,
BoilerplateType.ENTITY, BoilerplateType.ENTITY,
remarksBuilder.build(), remarksBuilder.build(),
ImmutableList.<ImmutableMap<String, Object>>of(), ImmutableList.of(),
linkBase); linkBase);
} else { } else {
ImmutableList<ImmutableMap<String, Object>> remarks = remarksBuilder.build(); ImmutableList<ImmutableMap<String, Object>> remarks = remarksBuilder.build();
@ -841,7 +841,7 @@ public class RdapJsonFormatter {
jsonBuilder, jsonBuilder,
BoilerplateType.ENTITY, BoilerplateType.ENTITY,
remarks, remarks,
ImmutableList.<ImmutableMap<String, Object>>of(), ImmutableList.of(),
linkBase); linkBase);
} else if (!remarks.isEmpty()) { } else if (!remarks.isEmpty()) {
jsonBuilder.put(REMARKS, remarks); jsonBuilder.put(REMARKS, remarks);
@ -1036,7 +1036,7 @@ public class RdapJsonFormatter {
jsonBuilder.add(nullToEmpty(address.getState())); jsonBuilder.add(nullToEmpty(address.getState()));
jsonBuilder.add(nullToEmpty(address.getZip())); jsonBuilder.add(nullToEmpty(address.getZip()));
jsonBuilder.add(new Locale("en", address.getCountryCode()).getDisplayCountry(new Locale("en"))); jsonBuilder.add(new Locale("en", address.getCountryCode()).getDisplayCountry(new Locale("en")));
return ImmutableList.<Object>of( return ImmutableList.of(
"adr", "adr",
ImmutableMap.of(), ImmutableMap.of(),
"text", "text",
@ -1046,7 +1046,7 @@ public class RdapJsonFormatter {
/** Creates a vCard phone number entry. */ /** Creates a vCard phone number entry. */
private static ImmutableList<Object> makePhoneEntry( private static ImmutableList<Object> makePhoneEntry(
ImmutableMap<String, ImmutableList<String>> type, String phoneNumber) { ImmutableMap<String, ImmutableList<String>> type, String phoneNumber) {
return ImmutableList.<Object>of("tel", type, "uri", phoneNumber); return ImmutableList.of("tel", type, "uri", phoneNumber);
} }
/** Creates a phone string in URI format, as per the vCard spec. */ /** Creates a phone string in URI format, as per the vCard spec. */
@ -1111,7 +1111,7 @@ public class RdapJsonFormatter {
* RFC 7483: JSON Responses for the Registration Data Access Protocol (RDAP)</a> * RFC 7483: JSON Responses for the Registration Data Access Protocol (RDAP)</a>
*/ */
ImmutableMap<String, Object> makeError(int status, String title, String description) { ImmutableMap<String, Object> makeError(int status, String title, String description) {
return ImmutableMap.<String, Object>of( return ImmutableMap.of(
"rdapConformance", CONFORMANCE_LIST, "rdapConformance", CONFORMANCE_LIST,
"lang", "en", "lang", "en",
"errorCode", (long) status, "errorCode", (long) status,

View file

@ -131,7 +131,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
jsonBuilder, jsonBuilder,
BoilerplateType.NAMESERVER, BoilerplateType.NAMESERVER,
results.getIncompletenessWarnings(), results.getIncompletenessWarnings(),
ImmutableList.<ImmutableMap<String, Object>>of(), ImmutableList.of(),
fullServletPath); fullServletPath);
return jsonBuilder.build(); return jsonBuilder.build();
} }

View file

@ -69,6 +69,6 @@ abstract class RdapSearchResults {
if (incompletenessWarningType() == IncompletenessWarningType.MIGHT_BE_INCOMPLETE) { if (incompletenessWarningType() == IncompletenessWarningType.MIGHT_BE_INCOMPLETE) {
return POSSIBLY_INCOMPLETE_NOTICES; return POSSIBLY_INCOMPLETE_NOTICES;
} }
return ImmutableList.<ImmutableMap<String, Object>>of(); return ImmutableList.of();
} }
} }

View file

@ -98,7 +98,7 @@ public class RdeImportUtils {
resource.getClass().getCanonicalName(), resource.getClass().getCanonicalName(),
resource.getForeignKey(), resource.getForeignKey(),
resource.getRepoId()); resource.getRepoId());
return ImmutableSet.<Object>of(ForeignKeyIndex.create(resource, resource.getDeletionTime()), return ImmutableSet.of(ForeignKeyIndex.create(resource, resource.getDeletionTime()),
EppResourceIndex.create(Key.create(resource))); EppResourceIndex.create(Key.create(resource)));
} }

View file

@ -191,7 +191,7 @@ final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
.collect(toImmutableSet())) .collect(toImmutableSet()))
.setDsData( .setDsData(
domain.getSecDNS() == null domain.getSecDNS() == null
? ImmutableSet.<DelegationSignerData>of() ? ImmutableSet.of()
: domain : domain
.getSecDNS() .getSecDNS()
.getDsDatas() .getDsDatas()

View file

@ -245,7 +245,7 @@ public final class Modules {
// GoogleCredential constructor. We don't yet know the actual scopes to use here, and it // GoogleCredential constructor. We don't yet know the actual scopes to use here, and it
// is thus the responsibility of every user of a delegated admin credential to call // is thus the responsibility of every user of a delegated admin credential to call
// createScoped() on it first to get the version with the correct scopes set. // createScoped() on it first to get the version with the correct scopes set.
.setServiceAccountScopes(ImmutableSet.<String>of()) .setServiceAccountScopes(ImmutableSet.of())
.setServiceAccountUser(gSuiteAdminAccountEmailAddress) .setServiceAccountUser(gSuiteAdminAccountEmailAddress)
.build(); .build();
} }

View file

@ -70,7 +70,7 @@ public final class RequestParameters {
String stringParam = req.getParameter(name); String stringParam = req.getParameter(name);
try { try {
return isNullOrEmpty(stringParam) return isNullOrEmpty(stringParam)
? Optional.<Integer>empty() ? Optional.empty()
: Optional.of(Integer.valueOf(stringParam)); : Optional.of(Integer.valueOf(stringParam));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new BadRequestException("Expected integer: " + name); throw new BadRequestException("Expected integer: " + name);
@ -93,7 +93,7 @@ public final class RequestParameters {
/** Returns all GET or POST parameters associated with {@code name}. */ /** Returns all GET or POST parameters associated with {@code name}. */
public static ImmutableSet<String> extractSetOfParameters(HttpServletRequest req, String name) { public static ImmutableSet<String> extractSetOfParameters(HttpServletRequest req, String name) {
String[] parameters = req.getParameterValues(name); String[] parameters = req.getParameterValues(name);
return parameters == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(parameters); return parameters == null ? ImmutableSet.of() : ImmutableSet.copyOf(parameters);
} }
/** /**
@ -135,7 +135,7 @@ public final class RequestParameters {
HttpServletRequest req, String name) { HttpServletRequest req, String name) {
String stringParam = req.getParameter(name); String stringParam = req.getParameter(name);
return isNullOrEmpty(stringParam) return isNullOrEmpty(stringParam)
? Optional.<Boolean>empty() ? Optional.empty()
: Optional.of(Boolean.valueOf(stringParam)); : Optional.of(Boolean.valueOf(stringParam));
} }
@ -179,7 +179,7 @@ public final class RequestParameters {
String stringParam = req.getParameter(name); String stringParam = req.getParameter(name);
try { try {
return isNullOrEmpty(stringParam) return isNullOrEmpty(stringParam)
? Optional.<DateTime>empty() ? Optional.empty()
: Optional.of(DateTime.parse(stringParam)); : Optional.of(DateTime.parse(stringParam));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new BadRequestException("Bad ISO 8601 timestamp: " + name); throw new BadRequestException("Bad ISO 8601 timestamp: " + name);
@ -198,7 +198,7 @@ public final class RequestParameters {
HttpServletRequest req, String name) { HttpServletRequest req, String name) {
String[] stringParams = req.getParameterValues(name); String[] stringParams = req.getParameterValues(name);
if (stringParams == null) { if (stringParams == null) {
return ImmutableSet.<DateTime>of(); return ImmutableSet.of();
} }
ImmutableSet.Builder<DateTime> datesBuilder = new ImmutableSet.Builder<>(); ImmutableSet.Builder<DateTime> datesBuilder = new ImmutableSet.Builder<>();
for (String stringParam : stringParams) { for (String stringParam : stringParams) {

View file

@ -30,7 +30,7 @@ public class AuthModule {
@Provides @Provides
ImmutableList<AuthenticationMechanism> provideApiAuthenticationMechanisms( ImmutableList<AuthenticationMechanism> provideApiAuthenticationMechanisms(
OAuthAuthenticationMechanism oauthAuthenticationMechanism) { OAuthAuthenticationMechanism oauthAuthenticationMechanism) {
return ImmutableList.<AuthenticationMechanism>of( return ImmutableList.of(
oauthAuthenticationMechanism); oauthAuthenticationMechanism);
} }

View file

@ -37,7 +37,7 @@ public abstract class AuthResult {
} }
public static AuthResult create(AuthLevel authLevel) { public static AuthResult create(AuthLevel authLevel) {
return new AutoValue_AuthResult(authLevel, Optional.<UserAuthInfo>empty()); return new AutoValue_AuthResult(authLevel, Optional.empty());
} }
public static AuthResult create(AuthLevel authLevel, @Nullable UserAuthInfo userAuthInfo) { public static AuthResult create(AuthLevel authLevel, @Nullable UserAuthInfo userAuthInfo) {

View file

@ -39,7 +39,7 @@ public abstract class UserAuthInfo {
public static UserAuthInfo create( public static UserAuthInfo create(
User user, boolean isUserAdmin) { User user, boolean isUserAdmin) {
return new AutoValue_UserAuthInfo(user, isUserAdmin, Optional.<OAuthTokenInfo>empty()); return new AutoValue_UserAuthInfo(user, isUserAdmin, Optional.empty());
} }
public static UserAuthInfo create( public static UserAuthInfo create(

View file

@ -33,7 +33,7 @@ public final class JsonResponseHelper {
/** Creates a JSON response message securely to the browser client with a parser breaker. */ /** Creates a JSON response message securely to the browser client with a parser breaker. */
public static ImmutableMap<String, Object> create( public static ImmutableMap<String, Object> create(
Status status, String message, Iterable<? extends Map<String, ?>> results) { Status status, String message, Iterable<? extends Map<String, ?>> results) {
return ImmutableMap.<String, Object>of( return ImmutableMap.of(
"status", status.toString(), "status", status.toString(),
"message", checkNotNull(message, "message"), "message", checkNotNull(message, "message"),
"results", ImmutableList.copyOf(results)); "results", ImmutableList.copyOf(results));
@ -41,7 +41,7 @@ public final class JsonResponseHelper {
/** Same as {@link #create(Status, String, Iterable)} but with zero results. */ /** Same as {@link #create(Status, String, Iterable)} but with zero results. */
public static ImmutableMap<String, Object> create(Status status, String message) { public static ImmutableMap<String, Object> create(Status status, String message) {
return create(status, message, ImmutableList.<Map<String, ?>>of()); return create(status, message, ImmutableList.of());
} }
/** Same as {@link #create(Status, String, Iterable)} but with only one results. */ /** Same as {@link #create(Status, String, Iterable)} but with only one results. */
@ -53,7 +53,7 @@ public final class JsonResponseHelper {
/** Creates a JSON response message when a submitted form field is invalid. */ /** Creates a JSON response message when a submitted form field is invalid. */
public static ImmutableMap<String, Object> createFormFieldError( public static ImmutableMap<String, Object> createFormFieldError(
String message, String formFieldName) { String message, String formFieldName) {
return ImmutableMap.<String, Object>of( return ImmutableMap.of(
"status", Status.ERROR.toString(), "status", Status.ERROR.toString(),
"message", checkNotNull(message, "message"), "message", checkNotNull(message, "message"),
"field", checkNotNull(formFieldName, "formFieldName"), "field", checkNotNull(formFieldName, "formFieldName"),

View file

@ -122,7 +122,7 @@ public final class IdnTable {
} }
int codepoint = readCodepoint(line); int codepoint = readCodepoint(line);
rangeSet.add(Range.<Integer>singleton(codepoint)); rangeSet.add(Range.singleton(codepoint));
} }
return new IdnTable(language, url, policy, rangeSet.build(), languageValidator); return new IdnTable(language, url, policy, rangeSet.build(), languageValidator);
} }

View file

@ -53,9 +53,9 @@ class JapaneseLanguageValidator extends LanguageValidator {
*/ */
private static final ImmutableRangeSet<Integer> JAPANESE_EXCEPTION_CODEPOINTS = private static final ImmutableRangeSet<Integer> JAPANESE_EXCEPTION_CODEPOINTS =
new ImmutableRangeSet.Builder<Integer>() new ImmutableRangeSet.Builder<Integer>()
.add(Range.<Integer>singleton(IDEOGRAPHIC_CLOSING_MARK)) .add(Range.singleton(IDEOGRAPHIC_CLOSING_MARK))
.add(Range.<Integer>singleton(KATAKANA_MIDDLE_DOT)) .add(Range.singleton(KATAKANA_MIDDLE_DOT))
.add(Range.<Integer>singleton(KATAKANA_HIRAGANA_PROLONGED_SOUND_MARK)) .add(Range.singleton(KATAKANA_HIRAGANA_PROLONGED_SOUND_MARK))
.build(); .build();
@Override @Override

View file

@ -21,7 +21,7 @@ abstract class LanguageValidator {
/** A registry of all known language validators keyed by their language code. */ /** A registry of all known language validators keyed by their language code. */
private static final ImmutableMap<String, LanguageValidator> LANGUAGE_VALIDATORS = private static final ImmutableMap<String, LanguageValidator> LANGUAGE_VALIDATORS =
ImmutableMap.<String, LanguageValidator>of("ja", new JapaneseLanguageValidator()); ImmutableMap.of("ja", new JapaneseLanguageValidator());
/** Return the language validator for the given language code (if one exists). */ /** Return the language validator for the given language code (if one exists). */
static Optional<LanguageValidator> get(String language) { static Optional<LanguageValidator> get(String language) {

View file

@ -45,7 +45,7 @@ public final class TmchCrlAction implements Runnable {
public void run() { public void run() {
try { try {
tmchCertificateAuthority.updateCrl( tmchCertificateAuthority.updateCrl(
new String(marksdb.fetch(tmchCrlUrl, Optional.<String>empty()), UTF_8), new String(marksdb.fetch(tmchCrlUrl, Optional.empty()), UTF_8),
tmchCrlUrl.toString()); tmchCrlUrl.toString());
} catch (IOException | GeneralSecurityException e) { } catch (IOException | GeneralSecurityException e) {
throw new RuntimeException("Failed to update ICANN TMCH CRL.", e); throw new RuntimeException("Failed to update ICANN TMCH CRL.", e);

View file

@ -129,7 +129,7 @@ class AppEngineConnection implements Connection {
public Map<String, Object> sendJson(String endpoint, Map<String, ?> object) throws IOException { public Map<String, Object> sendJson(String endpoint, Map<String, ?> object) throws IOException {
String response = send( String response = send(
endpoint, endpoint,
ImmutableMap.<String, Object>of(), ImmutableMap.of(),
JSON_UTF_8, JSON_UTF_8,
JSONValue.toJSONString(object).getBytes(UTF_8)); JSONValue.toJSONString(object).getBytes(UTF_8));
return (Map<String, Object>) JSONValue.parse(response.substring(JSON_SAFETY_PREFIX.length())); return (Map<String, Object>) JSONValue.parse(response.substring(JSON_SAFETY_PREFIX.length()));

View file

@ -109,6 +109,6 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd() { Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd() {
return initialTldState != null return initialTldState != null
? Optional.of(Maps.immutableEntry(START_OF_TIME, initialTldState)) ? Optional.of(Maps.immutableEntry(START_OF_TIME, initialTldState))
: Optional.<Map.Entry<DateTime, TldState>>empty(); : Optional.empty();
} }
} }

View file

@ -192,7 +192,7 @@ final class GenerateAuctionDataCommand implements RemoteApiCommand {
Optional<ContactAddress> address = Optional<ContactAddress> address =
Optional.ofNullable(postalInfo.isPresent() ? postalInfo.get().getAddress() : null); Optional.ofNullable(postalInfo.isPresent() ? postalInfo.get().getAddress() : null);
List<String> street = List<String> street =
address.isPresent() ? address.get().getStreet() : ImmutableList.<String>of(); address.isPresent() ? address.get().getStreet() : ImmutableList.of();
Optional<ContactPhoneNumber> phoneNumber = Optional.ofNullable(registrant.getVoiceNumber()); Optional<ContactPhoneNumber> phoneNumber = Optional.ofNullable(registrant.getVoiceNumber());
// Each line containing an auction participant has the following format: // Each line containing an auction participant has the following format:
@ -235,7 +235,7 @@ final class GenerateAuctionDataCommand implements RemoteApiCommand {
Optional.ofNullable(registrar.getLocalizedAddress()) Optional.ofNullable(registrar.getLocalizedAddress())
.orElse(registrar.getInternationalizedAddress())); .orElse(registrar.getInternationalizedAddress()));
List<String> street = List<String> street =
address.isPresent() ? address.get().getStreet() : ImmutableList.<String>of(); address.isPresent() ? address.get().getStreet() : ImmutableList.of();
// Each line containing the registrar of an auction participant has the following format: // Each line containing the registrar of an auction participant has the following format:
// //

View file

@ -99,7 +99,7 @@ final class GetSchemaTreeCommand implements Command {
// Build up the superclass to subclass mapping. // Build up the superclass to subclass mapping.
superclassToSubclasses = Multimaps.invertFrom( superclassToSubclasses = Multimaps.invertFrom(
Multimaps.forMap(subclassToSuperclass), Multimaps.forMap(subclassToSuperclass),
TreeMultimap.<Class<?>, Class<?>>create(arbitrary(), new PrintableNameOrdering())); TreeMultimap.create(arbitrary(), new PrintableNameOrdering()));
printTree(Object.class, 0); printTree(Object.class, 0);
} }

View file

@ -44,6 +44,6 @@ final class ListDomainsCommand extends ListObjectsCommand {
ImmutableMap<String, Object> getParameterMap() { ImmutableMap<String, Object> getParameterMap() {
String tldsParam = Joiner.on(',').join(tlds); String tldsParam = Joiner.on(',').join(tlds);
checkArgument(tldsParam.length() < 1024, "Total length of TLDs is too long for URL parameter"); checkArgument(tldsParam.length() < 1024, "Total length of TLDs is too long for URL parameter");
return ImmutableMap.<String, Object>of("tlds", tldsParam); return ImmutableMap.of("tlds", tldsParam);
} }
} }

View file

@ -48,7 +48,7 @@ enum RegistryToolEnvironment {
} }
private RegistryToolEnvironment(RegistryEnvironment actualEnvironment) { private RegistryToolEnvironment(RegistryEnvironment actualEnvironment) {
this(actualEnvironment, ImmutableMap.<String, String>of()); this(actualEnvironment, ImmutableMap.of());
} }
/** /**

View file

@ -201,16 +201,16 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
// Storing names and credentials in a list of tuples for later play-back. // Storing names and credentials in a list of tuples for later play-back.
List<List<String>> registrars = new ArrayList<>(); List<List<String>> registrars = new ArrayList<>();
registrars.add(ImmutableList.<String>of( registrars.add(ImmutableList.of(
registrar + "-1", passwordGenerator.createString(PASSWORD_LENGTH), registrar + "-1", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-sunrise")); registrar + "-sunrise"));
registrars.add(ImmutableList.<String>of( registrars.add(ImmutableList.of(
registrar + "-2", passwordGenerator.createString(PASSWORD_LENGTH), registrar + "-2", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-landrush")); registrar + "-landrush"));
registrars.add(ImmutableList.<String>of( registrars.add(ImmutableList.of(
registrar + "-3", passwordGenerator.createString(PASSWORD_LENGTH), registrar + "-3", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-ga")); registrar + "-ga"));
registrars.add(ImmutableList.<String>of( registrars.add(ImmutableList.of(
registrar + "-4", passwordGenerator.createString(PASSWORD_LENGTH), registrar + "-4", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-ga")); registrar + "-ga"));

View file

@ -123,7 +123,7 @@ class UpdateTldCommand extends CreateOrUpdateTldCommand {
Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd() { Optional<Map.Entry<DateTime, TldState>> getTldStateTransitionToAdd() {
return setCurrentTldState != null return setCurrentTldState != null
? Optional.of(Maps.immutableEntry(DateTime.now(DateTimeZone.UTC), setCurrentTldState)) ? Optional.of(Maps.immutableEntry(DateTime.now(DateTimeZone.UTC), setCurrentTldState))
: Optional.<Map.Entry<DateTime, TldState>>empty(); : Optional.empty();
} }
@Override @Override

View file

@ -25,6 +25,6 @@ public abstract class EnumParameter<T extends Enum<T>> extends ParameterConverte
@Override @Override
public T convert(String value) { public T convert(String value) {
return Enum.<T>valueOf(new TypeInstantiator<T>(getClass()){}.getExactType(), value); return Enum.valueOf(new TypeInstantiator<T>(getClass()){}.getExactType(), value);
} }
} }

View file

@ -150,7 +150,7 @@ public class GenerateZoneFilesAction implements Runnable, JsonActionRunner.JsonA
String.format( String.format(
GCS_PATH_FORMAT, bucket, String.format(FILENAME_FORMAT, tld, exportTime))) GCS_PATH_FORMAT, bucket, String.format(FILENAME_FORMAT, tld, exportTime)))
.collect(toImmutableList()); .collect(toImmutableList());
return ImmutableMap.<String, Object>of( return ImmutableMap.of(
"jobPath", createJobPath(jobId), "jobPath", createJobPath(jobId),
"filenames", filenames); "filenames", filenames);
} }

View file

@ -236,7 +236,7 @@ public abstract class ListObjectsAction<T extends ImmutableObject> implements Ru
if (isHeaderRowInUse(data)) { if (isHeaderRowInUse(data)) {
// Add a row of headers (column names mapping to themselves). // Add a row of headers (column names mapping to themselves).
Map<String, String> headerRow = Map<String, String> headerRow =
Maps.asMap(data.columnKeySet(), Functions.<String>identity()); Maps.asMap(data.columnKeySet(), Functions.identity());
lines.add(rowFormatter.apply(headerRow)); lines.add(rowFormatter.apply(headerRow));
// Add a row of separator lines (column names mapping to '-' * column width). // Add a row of separator lines (column names mapping to '-' * column width).

View file

@ -58,8 +58,8 @@ public class ResaveAllHistoryEntriesAction implements Runnable {
.runMapOnly( .runMapOnly(
new ResaveAllHistoryEntriesActionMapper(), new ResaveAllHistoryEntriesActionMapper(),
ImmutableList.of(EppResourceInputs.createChildEntityInput( ImmutableList.of(EppResourceInputs.createChildEntityInput(
ImmutableSet.<Class<? extends EppResource>>of(EppResource.class), ImmutableSet.of(EppResource.class),
ImmutableSet.<Class<? extends HistoryEntry>>of(HistoryEntry.class)))))); ImmutableSet.of(HistoryEntry.class))))));
} }
/** Mapper to re-save all HistoryEntry entities. */ /** Mapper to re-save all HistoryEntry entities. */

View file

@ -49,7 +49,7 @@ public class ToolsServerModule {
@Parameter("fullFieldNames") @Parameter("fullFieldNames")
static Optional<Boolean> provideFullFieldNames(HttpServletRequest req) { static Optional<Boolean> provideFullFieldNames(HttpServletRequest req) {
String s = emptyToNull(req.getParameter(ListObjectsAction.FULL_FIELD_NAMES_PARAM)); String s = emptyToNull(req.getParameter(ListObjectsAction.FULL_FIELD_NAMES_PARAM));
return (s == null) ? Optional.<Boolean>empty() : Optional.of(Boolean.parseBoolean(s)); return (s == null) ? Optional.empty() : Optional.of(Boolean.parseBoolean(s));
} }
@Provides @Provides
@ -74,7 +74,7 @@ public class ToolsServerModule {
@Parameter("printHeaderRow") @Parameter("printHeaderRow")
static Optional<Boolean> providePrintHeaderRow(HttpServletRequest req) { static Optional<Boolean> providePrintHeaderRow(HttpServletRequest req) {
String s = emptyToNull(req.getParameter(ListObjectsAction.PRINT_HEADER_ROW_PARAM)); String s = emptyToNull(req.getParameter(ListObjectsAction.PRINT_HEADER_ROW_PARAM));
return (s == null) ? Optional.<Boolean>empty() : Optional.of(Boolean.parseBoolean(s)); return (s == null) ? Optional.empty() : Optional.of(Boolean.parseBoolean(s));
} }
@Provides @Provides

View file

@ -177,7 +177,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
HOST_CREATES_SUBORDINATE(1, equalTo(Type.HOST_CREATE), IS_SUBORDINATE), HOST_CREATES_SUBORDINATE(1, equalTo(Type.HOST_CREATE), IS_SUBORDINATE),
HOST_DELETES(1, equalTo(Type.HOST_DELETE)), HOST_DELETES(1, equalTo(Type.HOST_DELETE)),
HOST_UPDATES(1, equalTo(Type.HOST_UPDATE)), HOST_UPDATES(1, equalTo(Type.HOST_UPDATE)),
UNCLASSIFIED_FLOWS(0, Predicates.<HistoryEntry.Type>alwaysFalse()); UNCLASSIFIED_FLOWS(0, Predicates.alwaysFalse());
/** The number of StatTypes with a non-zero requirement. */ /** The number of StatTypes with a non-zero requirement. */
private static final int NUM_REQUIREMENTS = private static final int NUM_REQUIREMENTS =
@ -205,7 +205,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
this.requirement = requirement; this.requirement = requirement;
this.typeFilter = typeFilter; this.typeFilter = typeFilter;
if (eppInputFilter == null) { if (eppInputFilter == null) {
this.eppInputFilter = Optional.<Predicate<EppInput>>empty(); this.eppInputFilter = Optional.empty();
} else { } else {
this.eppInputFilter = Optional.of(eppInputFilter); this.eppInputFilter = Optional.of(eppInputFilter);
} }
@ -260,7 +260,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
// xmlBytes can be null on contact create and update for safe-harbor compliance. // xmlBytes can be null on contact create and update for safe-harbor compliance.
final Optional<EppInput> eppInput = final Optional<EppInput> eppInput =
(xmlBytes == null) (xmlBytes == null)
? Optional.<EppInput>empty() ? Optional.empty()
: Optional.of(unmarshal(EppInput.class, xmlBytes)); : Optional.of(unmarshal(EppInput.class, xmlBytes));
if (!statCounts.addAll( if (!statCounts.addAll(
EnumSet.allOf(StatType.class) EnumSet.allOf(StatType.class)

View file

@ -137,7 +137,7 @@ public final class FormField<I, O> {
/** Returns an optional form field named {@code name} with a specific {@code inputType}. */ /** Returns an optional form field named {@code name} with a specific {@code inputType}. */
public static <T> Builder<T, T> named(String name, Class<T> typeIn) { public static <T> Builder<T, T> named(String name, Class<T> typeIn) {
checkArgument(!name.isEmpty()); checkArgument(!name.isEmpty());
return new Builder<>(name, checkNotNull(typeIn), typeIn, Functions.<T>identity()); return new Builder<>(name, checkNotNull(typeIn), typeIn, Functions.identity());
} }
/** /**

View file

@ -43,7 +43,6 @@ import google.registry.security.JsonResponseHelper;
import google.registry.ui.forms.FormException; import google.registry.ui.forms.FormException;
import google.registry.ui.forms.FormFieldException; import google.registry.ui.forms.FormFieldException;
import google.registry.ui.server.RegistrarFormFields; import google.registry.ui.server.RegistrarFormFields;
import google.registry.util.CidrAddressBlock;
import google.registry.util.CollectionUtils; import google.registry.util.CollectionUtils;
import google.registry.util.DiffUtils; import google.registry.util.DiffUtils;
import java.util.HashSet; import java.util.HashSet;
@ -192,7 +191,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
builder.setIpAddressWhitelist( builder.setIpAddressWhitelist(
RegistrarFormFields.IP_ADDRESS_WHITELIST_FIELD RegistrarFormFields.IP_ADDRESS_WHITELIST_FIELD
.extractUntyped(args) .extractUntyped(args)
.orElse(ImmutableList.<CidrAddressBlock>of())); .orElse(ImmutableList.of()));
RegistrarFormFields.CLIENT_CERTIFICATE_FIELD RegistrarFormFields.CLIENT_CERTIFICATE_FIELD
.extractUntyped(args) .extractUntyped(args)
.ifPresent( .ifPresent(

View file

@ -85,28 +85,28 @@ public class CollectionUtils {
/** Defensive copy helper for {@link Set}. */ /** Defensive copy helper for {@link Set}. */
public static <V> ImmutableSet<V> nullToEmptyImmutableCopy(Set<V> data) { public static <V> ImmutableSet<V> nullToEmptyImmutableCopy(Set<V> data) {
return data == null ? ImmutableSet.<V>of() : ImmutableSet.copyOf(data); return data == null ? ImmutableSet.of() : ImmutableSet.copyOf(data);
} }
/** Defensive copy helper for {@link Set}. */ /** Defensive copy helper for {@link Set}. */
public static <V extends Comparable<V>> public static <V extends Comparable<V>>
ImmutableSortedSet<V> nullToEmptyImmutableSortedCopy(Set<V> data) { ImmutableSortedSet<V> nullToEmptyImmutableSortedCopy(Set<V> data) {
return data == null ? ImmutableSortedSet.<V>of() : ImmutableSortedSet.copyOf(data); return data == null ? ImmutableSortedSet.of() : ImmutableSortedSet.copyOf(data);
} }
/** Defensive copy helper for {@link SortedMap}. */ /** Defensive copy helper for {@link SortedMap}. */
public static <K, V> ImmutableSortedMap<K, V> nullToEmptyImmutableCopy(SortedMap<K, V> data) { public static <K, V> ImmutableSortedMap<K, V> nullToEmptyImmutableCopy(SortedMap<K, V> data) {
return data == null ? ImmutableSortedMap.<K, V>of() : ImmutableSortedMap.copyOfSorted(data); return data == null ? ImmutableSortedMap.of() : ImmutableSortedMap.copyOfSorted(data);
} }
/** Defensive copy helper for {@link List}. */ /** Defensive copy helper for {@link List}. */
public static <V> ImmutableList<V> nullToEmptyImmutableCopy(List<V> data) { public static <V> ImmutableList<V> nullToEmptyImmutableCopy(List<V> data) {
return data == null ? ImmutableList.<V>of() : ImmutableList.copyOf(data); return data == null ? ImmutableList.of() : ImmutableList.copyOf(data);
} }
/** Defensive copy helper for {@link Map}. */ /** Defensive copy helper for {@link Map}. */
public static <K, V> ImmutableMap<K, V> nullToEmptyImmutableCopy(Map<K, V> data) { public static <K, V> ImmutableMap<K, V> nullToEmptyImmutableCopy(Map<K, V> data) {
return data == null ? ImmutableMap.<K, V>of() : ImmutableMap.copyOf(data); return data == null ? ImmutableMap.of() : ImmutableMap.copyOf(data);
} }
/** /**

View file

@ -42,7 +42,7 @@ public final class SqlTemplate {
/** Returns a new immutable SQL template builder object, for query parameter substitution. */ /** Returns a new immutable SQL template builder object, for query parameter substitution. */
public static SqlTemplate create(String template) { public static SqlTemplate create(String template) {
return new SqlTemplate(template, ImmutableMap.<String, String>of()); return new SqlTemplate(template, ImmutableMap.of());
} }
/** /**

View file

@ -35,7 +35,6 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory; import java.security.cert.CertificateFactory;
import java.security.cert.CertificateParsingException; import java.security.cert.CertificateParsingException;
import java.security.cert.CertificateRevokedException; import java.security.cert.CertificateRevokedException;
import java.security.cert.Extension;
import java.security.cert.X509CRL; import java.security.cert.X509CRL;
import java.security.cert.X509CRLEntry; import java.security.cert.X509CRLEntry;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
@ -149,7 +148,7 @@ public final class X509Utils {
checkNotNull(entry.getRevocationDate(), "revocationDate"), checkNotNull(entry.getRevocationDate(), "revocationDate"),
checkNotNull(entry.getRevocationReason(), "revocationReason"), checkNotNull(entry.getRevocationReason(), "revocationReason"),
firstNonNull(entry.getCertificateIssuer(), crl.getIssuerX500Principal()), firstNonNull(entry.getCertificateIssuer(), crl.getIssuerX500Principal()),
ImmutableMap.<String, Extension>of()); ImmutableMap.of());
} }
} }

View file

@ -32,7 +32,7 @@ public class DomainLookupCommand extends DomainOrHostLookupCommand {
protected Optional<WhoisResponse> getResponse(InternetDomainName domainName, DateTime now) { protected Optional<WhoisResponse> getResponse(InternetDomainName domainName, DateTime now) {
final DomainResource domainResource = final DomainResource domainResource =
loadByForeignKey(DomainResource.class, domainName.toString(), now); loadByForeignKey(DomainResource.class, domainName.toString(), now);
return Optional.<WhoisResponse>ofNullable( return Optional.ofNullable(
domainResource == null ? null : new DomainWhoisResponse(domainResource, now)); domainResource == null ? null : new DomainWhoisResponse(domainResource, now));
} }
} }

View file

@ -32,7 +32,7 @@ public class NameserverLookupByHostCommand extends DomainOrHostLookupCommand {
protected Optional<WhoisResponse> getResponse(InternetDomainName hostName, DateTime now) { protected Optional<WhoisResponse> getResponse(InternetDomainName hostName, DateTime now) {
final HostResource hostResource = final HostResource hostResource =
loadByForeignKey(HostResource.class, hostName.toString(), now); loadByForeignKey(HostResource.class, hostName.toString(), now);
return Optional.<WhoisResponse>ofNullable( return Optional.ofNullable(
hostResource == null ? null : new NameserverWhoisResponse(hostResource, now)); hostResource == null ? null : new NameserverWhoisResponse(hostResource, now));
} }
} }

View file

@ -240,7 +240,7 @@ public class XmlTransformer {
*/ */
public void marshalStrict(Object root, Result result) throws XmlException { public void marshalStrict(Object root, Result result) throws XmlException {
try { try {
getMarshaller(schema, ImmutableMap.<String, Object>of()) getMarshaller(schema, ImmutableMap.of())
.marshal(checkNotNull(root, "root"), checkNotNull(result, "result")); .marshal(checkNotNull(root, "root"), checkNotNull(result, "result"));
} catch (JAXBException e) { } catch (JAXBException e) {
throw new XmlException(e); throw new XmlException(e);

View file

@ -116,7 +116,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
Set<ImmutableObject> ibEntities = persistLotsOfDomains("ib-any.test"); Set<ImmutableObject> ibEntities = persistLotsOfDomains("ib-any.test");
runMapreduce(); runMapreduce();
assertDeleted(ibEntities); assertDeleted(ibEntities);
assertNotDeleted(ImmutableSet.<ImmutableObject>of(nic, fkiNic)); assertNotDeleted(ImmutableSet.of(nic, fkiNic));
} }
@Test @Test
@ -254,7 +254,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
ForeignKeyIndex.load(DomainResource.class, fqdn, START_OF_TIME); ForeignKeyIndex.load(DomainResource.class, fqdn, START_OF_TIME);
EppResourceIndex eppIndex = EppResourceIndex eppIndex =
ofy().load().entity(EppResourceIndex.create(Key.create(domain))).now(); ofy().load().entity(EppResourceIndex.create(Key.create(domain))).now();
return ImmutableSet.<ImmutableObject>of( return ImmutableSet.of(
domain, historyEntry, billingEvent, pollMessage, fki, eppIndex); domain, historyEntry, billingEvent, pollMessage, fki, eppIndex);
} }

View file

@ -265,7 +265,7 @@ public class MapreduceEntityCleanupActionTest
createMapreduce("jobname"); createMapreduce("jobname");
executeTasksUntilEmpty(QUEUE_NAME, clock); executeTasksUntilEmpty(QUEUE_NAME, clock);
setJobIdJobNameAndDaysOld( setJobIdJobNameAndDaysOld(
Optional.<String>empty(), Optional.<String>empty(), Optional.<Integer>empty()); Optional.empty(), Optional.empty(), Optional.empty());
action.run(); action.run();
@ -349,11 +349,11 @@ public class MapreduceEntityCleanupActionTest
executeTasksUntilEmpty(QUEUE_NAME, clock); executeTasksUntilEmpty(QUEUE_NAME, clock);
clock.setTo(DateTime.now(UTC)); clock.setTo(DateTime.now(UTC));
action = new MapreduceEntityCleanupAction( action = new MapreduceEntityCleanupAction(
Optional.<String>empty(), // jobId Optional.empty(), // jobId
Optional.<String>empty(), // jobName Optional.empty(), // jobName
Optional.<Integer>of(1), // numJobsToDelete Optional.of(1), // numJobsToDelete
Optional.<Integer>of(0), // daysOld Optional.of(0), // daysOld
Optional.<Boolean>empty(), // force Optional.empty(), // force
mapreduceEntityCleanupUtil, mapreduceEntityCleanupUtil,
clock, clock,
DatastoreServiceFactory.getDatastoreService(), DatastoreServiceFactory.getDatastoreService(),
@ -428,10 +428,10 @@ public class MapreduceEntityCleanupActionTest
clock.setTo(DateTime.now(UTC)); clock.setTo(DateTime.now(UTC));
action = new MapreduceEntityCleanupAction( action = new MapreduceEntityCleanupAction(
Optional.of(jobId2), // jobId Optional.of(jobId2), // jobId
Optional.<String>empty(), // jobName Optional.empty(), // jobName
Optional.<Integer>empty(), // numJobsToDelete Optional.empty(), // numJobsToDelete
Optional.<Integer>empty(), // daysOld Optional.empty(), // daysOld
Optional.<Boolean>empty(), // force Optional.empty(), // force
mapreduceEntityCleanupUtil, mapreduceEntityCleanupUtil,
clock, clock,
DatastoreServiceFactory.getDatastoreService(), DatastoreServiceFactory.getDatastoreService(),
@ -453,7 +453,7 @@ public class MapreduceEntityCleanupActionTest
@Test @Test
public void testDeleteOfRunningJob_fails() throws Exception { public void testDeleteOfRunningJob_fails() throws Exception {
String jobId = createMapreduce("jobname"); String jobId = createMapreduce("jobname");
executeTasks(QUEUE_NAME, clock, Optional.<Integer>of(10)); executeTasks(QUEUE_NAME, clock, Optional.of(10));
setJobId(jobId); setJobId(jobId);
action.run(); action.run();
@ -469,13 +469,13 @@ public class MapreduceEntityCleanupActionTest
@Test @Test
public void testDeleteOfRunningJob_succeedsWithForce() throws Exception { public void testDeleteOfRunningJob_succeedsWithForce() throws Exception {
String jobId = createMapreduce("jobname"); String jobId = createMapreduce("jobname");
executeTasks(QUEUE_NAME, clock, Optional.<Integer>of(10)); executeTasks(QUEUE_NAME, clock, Optional.of(10));
clock.setTo(DateTime.now(UTC)); clock.setTo(DateTime.now(UTC));
action = new MapreduceEntityCleanupAction( action = new MapreduceEntityCleanupAction(
Optional.of(jobId), Optional.of(jobId),
Optional.<String>empty(), // jobName Optional.empty(), // jobName
Optional.<Integer>empty(), // numJobsToDelete Optional.empty(), // numJobsToDelete
Optional.<Integer>empty(), // daysOld Optional.empty(), // daysOld
Optional.of(true), // force Optional.of(true), // force
mapreduceEntityCleanupUtil, mapreduceEntityCleanupUtil,
clock, clock,
@ -497,7 +497,7 @@ public class MapreduceEntityCleanupActionTest
@Test @Test
public void testJobIdAndJobName_fails() throws Exception { public void testJobIdAndJobName_fails() throws Exception {
setJobIdJobNameAndDaysOld( setJobIdJobNameAndDaysOld(
Optional.of("jobid"), Optional.of("jobname"), Optional.<Integer>empty()); Optional.of("jobid"), Optional.of("jobname"), Optional.empty());
action.run(); action.run();
@ -509,7 +509,7 @@ public class MapreduceEntityCleanupActionTest
@Test @Test
public void testJobIdAndDaysOld_fails() throws Exception { public void testJobIdAndDaysOld_fails() throws Exception {
setJobIdJobNameAndDaysOld(Optional.of("jobid"), Optional.<String>empty(), Optional.of(0)); setJobIdJobNameAndDaysOld(Optional.of("jobid"), Optional.empty(), Optional.of(0));
action.run(); action.run();
@ -524,10 +524,10 @@ public class MapreduceEntityCleanupActionTest
public void testJobIdAndNumJobs_fails() throws Exception { public void testJobIdAndNumJobs_fails() throws Exception {
action = new MapreduceEntityCleanupAction( action = new MapreduceEntityCleanupAction(
Optional.of("jobid"), Optional.of("jobid"),
Optional.<String>empty(), // jobName Optional.empty(), // jobName
Optional.of(1), // numJobsToDelete Optional.of(1), // numJobsToDelete
Optional.<Integer>empty(), // daysOld Optional.empty(), // daysOld
Optional.<Boolean>empty(), // force Optional.empty(), // force
mapreduceEntityCleanupUtil, mapreduceEntityCleanupUtil,
clock, clock,
DatastoreServiceFactory.getDatastoreService(), DatastoreServiceFactory.getDatastoreService(),
@ -545,11 +545,11 @@ public class MapreduceEntityCleanupActionTest
@Test @Test
public void testDeleteZeroJobs_throwsUsageError() throws Exception { public void testDeleteZeroJobs_throwsUsageError() throws Exception {
new MapreduceEntityCleanupAction( new MapreduceEntityCleanupAction(
Optional.<String>empty(), // jobId Optional.empty(), // jobId
Optional.<String>empty(), // jobName Optional.empty(), // jobName
Optional.<Integer>of(0), // numJobsToDelete Optional.of(0), // numJobsToDelete
Optional.<Integer>empty(), // daysOld Optional.empty(), // daysOld
Optional.<Boolean>empty(), // force Optional.empty(), // force
mapreduceEntityCleanupUtil, mapreduceEntityCleanupUtil,
clock, clock,
DatastoreServiceFactory.getDatastoreService(), DatastoreServiceFactory.getDatastoreService(),

View file

@ -86,7 +86,7 @@ public class TldFanoutActionTest {
action.queue = getLast(params.get("queue")); action.queue = getLast(params.get("queue"));
action.excludes = params.containsKey("exclude") action.excludes = params.containsKey("exclude")
? ImmutableSet.copyOf(Splitter.on(',').split(params.get("exclude").get(0))) ? ImmutableSet.copyOf(Splitter.on(',').split(params.get("exclude").get(0)))
: ImmutableSet.<String>of(); : ImmutableSet.of();
action.taskEnqueuer = new TaskEnqueuer(new Retrier(null, 1)); action.taskEnqueuer = new TaskEnqueuer(new Retrier(null, 1));
action.response = response; action.response = response;
action.runInEmpty = params.containsKey("runInEmpty"); action.runInEmpty = params.containsKey("runInEmpty");

View file

@ -84,8 +84,8 @@ public class PublishDnsUpdatesActionTest {
PublishDnsUpdatesAction action = new PublishDnsUpdatesAction(); PublishDnsUpdatesAction action = new PublishDnsUpdatesAction();
action.timeout = Duration.standardSeconds(10); action.timeout = Duration.standardSeconds(10);
action.tld = tld; action.tld = tld;
action.hosts = ImmutableSet.<String>of(); action.hosts = ImmutableSet.of();
action.domains = ImmutableSet.<String>of(); action.domains = ImmutableSet.of();
action.dnsWriter = "mock"; action.dnsWriter = "mock";
action.dnsWriterProxy = new DnsWriterProxy(ImmutableMap.of("mock", dnsWriter)); action.dnsWriterProxy = new DnsWriterProxy(ImmutableMap.of("mock", dnsWriter));
action.dnsMetrics = dnsMetrics; action.dnsMetrics = dnsMetrics;

View file

@ -32,7 +32,6 @@ import com.google.api.services.dns.model.Change;
import com.google.api.services.dns.model.ResourceRecordSet; import com.google.api.services.dns.model.ResourceRecordSet;
import com.google.api.services.dns.model.ResourceRecordSetsListResponse; import com.google.api.services.dns.model.ResourceRecordSetsListResponse;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.net.InetAddresses; import com.google.common.net.InetAddresses;
@ -305,12 +304,12 @@ public class CloudDnsWriterTest {
public void testLoadDomain_nonExistentDomain() throws Exception { public void testLoadDomain_nonExistentDomain() throws Exception {
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
verifyZone(ImmutableSet.<ResourceRecordSet>of()); verifyZone(ImmutableSet.of());
} }
@Test @Test
public void testLoadDomain_noDsDataOrNameservers() throws Exception { public void testLoadDomain_noDsDataOrNameservers() throws Exception {
persistResource(fakeDomain("example.tld", ImmutableSet.<HostResource>of(), 0)); persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
verifyZone(fakeDomainRecords("example.tld", 0, 0, 0, 0)); verifyZone(fakeDomainRecords("example.tld", 0, 0, 0, 0));
@ -319,7 +318,7 @@ public class CloudDnsWriterTest {
@Test @Test
public void testLoadDomain_deleteOldData() throws Exception { public void testLoadDomain_deleteOldData() throws Exception {
stubZone = fakeDomainRecords("example.tld", 2, 2, 2, 2); stubZone = fakeDomainRecords("example.tld", 2, 2, 2, 2);
persistResource(fakeDomain("example.tld", ImmutableSet.<HostResource>of(), 0)); persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
verifyZone(fakeDomainRecords("example.tld", 0, 0, 0, 0)); verifyZone(fakeDomainRecords("example.tld", 0, 0, 0, 0));
@ -378,7 +377,7 @@ public class CloudDnsWriterTest {
writer.publishHost("ns1.example.com"); writer.publishHost("ns1.example.com");
// external hosts should not be published in our zone // external hosts should not be published in our zone
verifyZone(ImmutableSet.<ResourceRecordSet>of()); verifyZone(ImmutableSet.of());
} }
@Test @Test
@ -409,7 +408,7 @@ public class CloudDnsWriterTest {
CloudDnsWriter spyWriter = spy(writer); CloudDnsWriter spyWriter = spy(writer);
when(mutateZoneCallable.call()).thenThrow(ZoneStateException.class).thenReturn(null); when(mutateZoneCallable.call()).thenThrow(ZoneStateException.class).thenReturn(null);
when(spyWriter.getMutateZoneCallback( when(spyWriter.getMutateZoneCallback(
Matchers.<ImmutableMap<String, ImmutableSet<ResourceRecordSet>>>any())) Matchers.any()))
.thenReturn(mutateZoneCallable); .thenReturn(mutateZoneCallable);
spyWriter.commit(); spyWriter.commit();
@ -428,7 +427,7 @@ public class CloudDnsWriterTest {
.build()); .build());
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
verifyZone(ImmutableSet.<ResourceRecordSet>of()); verifyZone(ImmutableSet.of());
} }
@Test @Test
@ -444,7 +443,7 @@ public class CloudDnsWriterTest {
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
verifyZone(ImmutableSet.<ResourceRecordSet>of()); verifyZone(ImmutableSet.of());
} }
@Test @Test
@ -459,7 +458,7 @@ public class CloudDnsWriterTest {
.build()); .build());
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
verifyZone(ImmutableSet.<ResourceRecordSet>of()); verifyZone(ImmutableSet.of());
} }
@Test @Test

View file

@ -18,7 +18,6 @@ import static com.google.common.collect.Iterables.getLast;
import static com.google.common.io.BaseEncoding.base16; import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_; import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName; import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents; import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
@ -1092,10 +1091,7 @@ public class DomainApplicationCreateFlowTest
@Test @Test
public void testFailure_notAuthorizedForTld() throws Exception { public void testFailure_notAuthorizedForTld() throws Exception {
persistResource( persistResource(
loadRegistrar("TheRegistrar") loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
persistContactsAndHosts(); persistContactsAndHosts();
thrown.expect(NotAuthorizedForTldException.class); thrown.expect(NotAuthorizedForTldException.class);
runFlow(); runFlow();
@ -1148,10 +1144,7 @@ public class DomainApplicationCreateFlowTest
@Test @Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception { public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistResource( persistResource(
loadRegistrar("TheRegistrar") loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
runSuperuserFlow("domain_create_sunrise_encoded_signed_mark_response.xml"); runSuperuserFlow("domain_create_sunrise_encoded_signed_mark_response.xml");

Some files were not shown because too many files have changed in this diff Show more