Fix a few Java 9+isms and ignore IML files (#973)

This allows us to run tests in IDEA which is significantly quicker. We
shouldn't be using anything past Java 8 anyway since that's what GAE
runs with.
This commit is contained in:
gbrodman 2021-02-25 14:59:00 -05:00 committed by GitHub
parent 61599b0d45
commit d79a8b1513
4 changed files with 10 additions and 9 deletions

2
.gitignore vendored
View file

@ -75,7 +75,7 @@ local.properties
autogenerated/
# IDEA
nomulus.iml
**/*.iml
nomulus.ipr
nomulus.iws

View file

@ -140,11 +140,13 @@ public class ReplayCommitLogsToSqlAction implements Runnable {
transaction.stream()
.sorted(ReplayCommitLogsToSqlAction::compareByWeight)
.forEach(
versionedEntity ->
versionedEntity
.getEntity()
.ifPresentOrElse(
this::handleEntityPut, () -> handleEntityDelete(versionedEntity)));
versionedEntity -> {
if (versionedEntity.getEntity().isPresent()) {
handleEntityPut(versionedEntity.getEntity().get());
} else {
handleEntityDelete(versionedEntity);
}
});
}
private void handleEntityPut(Entity entity) {

View file

@ -151,7 +151,7 @@ public class BackfillRegistryLocksCommand extends ConfirmingCommand
return domains.stream()
.filter(d -> d.getDeletionTime().isAfter(now))
.filter(d -> d.getStatusValues().containsAll(REGISTRY_LOCK_STATUSES))
.filter(d -> RegistryLockDao.getMostRecentByRepoId(d.getRepoId()).isEmpty())
.filter(d -> !RegistryLockDao.getMostRecentByRepoId(d.getRepoId()).isPresent())
.collect(toImmutableList());
}
}

View file

@ -36,7 +36,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collector;
import javax.annotation.Nullable;
@ -244,7 +243,7 @@ public final class ImmutableObjectSubject extends Subject {
// We just need to check if there were any objects in "actual" that were not in "expected"
// (where "found" is a proxy for "expected").
} else if (actual.stream().anyMatch(Predicate.not(found::contains))) {
} else if (!found.containsAll(actual)) {
return ComparisonResult.createFailure();
}