Run automatic Java 8 conversion over codebase

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
This commit is contained in:
mcilwain 2017-10-05 10:48:38 -07:00 committed by Ben McIlwain
parent 44df5da771
commit 5edb7935ed
190 changed files with 2312 additions and 3096 deletions

View file

@ -20,8 +20,6 @@ import static com.google.common.truth.Truth.assert_;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static org.joda.time.DateTimeZone.UTC;
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.googlecode.objectify.annotation.Id;
@ -157,14 +155,11 @@ public class EntityTestCase {
}
// Descend into persisted ImmutableObject classes, but not anything else.
if (ImmutableObject.class.isAssignableFrom(fieldClass)) {
fields.addAll(FluentIterable
.from(getAllPotentiallyIndexedFieldPaths(fieldClass))
.transform(new Function<String, String>(){
@Override
public String apply(String subfield) {
return field.getName() + "." + subfield;
}})
.toSet());
getAllPotentiallyIndexedFieldPaths(fieldClass)
.stream()
.map(subfield -> field.getName() + "." + subfield)
.distinct()
.forEachOrdered(fields::add);
} else {
fields.add(field.getName());
}

View file

@ -14,6 +14,7 @@
package google.registry.model.domain;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
@ -26,7 +27,6 @@ import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
@ -52,6 +52,7 @@ import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
import google.registry.model.transfer.TransferStatus;
import google.registry.testing.ExceptionRule;
import java.util.stream.Stream;
import org.joda.money.Money;
import org.joda.time.DateTime;
import org.junit.Before;
@ -363,9 +364,13 @@ public class DomainResourceTest extends EntityTestCase {
ImmutableSet<GracePeriod> renewGracePeriods = ImmutableSet.of(
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(3), "foo", null),
GracePeriod.create(GracePeriodStatus.RENEW, clock.nowUtc().plusDays(1), "baz", null));
domain = domain.asBuilder()
.setGracePeriods(FluentIterable.from(addGracePeriods).append(renewGracePeriods).toSet())
.build();
domain =
domain
.asBuilder()
.setGracePeriods(
Stream.concat(addGracePeriods.stream(), renewGracePeriods.stream())
.collect(toImmutableSet()))
.build();
assertThat(domain.getGracePeriodsOfType(GracePeriodStatus.ADD)).isEqualTo(addGracePeriods);
assertThat(domain.getGracePeriodsOfType(GracePeriodStatus.RENEW)).isEqualTo(renewGracePeriods);
assertThat(domain.getGracePeriodsOfType(GracePeriodStatus.TRANSFER)).isEmpty();

View file

@ -95,9 +95,5 @@ public class PremiumListTest {
/** Gets the label of a premium list entry. */
public static final Function<Key<PremiumListEntry>, String> GET_ENTRY_NAME_FUNCTION =
new Function<Key<PremiumListEntry>, String>() {
@Override
public String apply(final Key<PremiumListEntry> input) {
return input.getName();
}};
Key::getName;
}

View file

@ -551,10 +551,5 @@ public class ReservedListTest {
}
/** Gets the name of a reserved list. */
public static final Function<Key<ReservedList>, String> GET_NAME_FUNCTION =
new Function<Key<ReservedList>, String>() {
@Override
public String apply(final Key<ReservedList> input) {
return input.getName();
}};
public static final Function<Key<ReservedList>, String> GET_NAME_FUNCTION = Key::getName;
}