Upgrade google-java-format to 1.7
This new version has the nice feature of putting multiple chained method calls before a .stream() on a single line. The diff is a bit large but it's removing a lot of newlines which is nice. Change-Id: I260b620aa6a1bc77b06be9672a1f281ab0d0d0f8
This commit is contained in:
parent
83fab68dc5
commit
3efa1058b2
@ -153,7 +153,7 @@ Guide].
|
||||
|
||||
To format Java source code, Gerrit uses the
|
||||
link:https://github.com/google/google-java-format[`google-java-format`]
|
||||
tool (version 1.6), and to format Bazel BUILD, WORKSPACE and .bzl files the
|
||||
tool (version 1.7), and to format Bazel BUILD, WORKSPACE and .bzl files the
|
||||
link:https://github.com/bazelbuild/buildtools/tree/master/buildifier[`buildifier`]
|
||||
tool (version 0.20.0).
|
||||
These tools automatically apply format according to the style guides; this
|
||||
|
@ -47,7 +47,7 @@ Filters on a folder, they will be overwritten the next time you run
|
||||
|
||||
To format source code, Gerrit uses the
|
||||
link:https://github.com/google/google-java-format[`google-java-format`]
|
||||
tool (version 1.3), which automatically formats code to follow the
|
||||
tool (version 1.7), which automatically formats code to follow the
|
||||
style guide. See link:dev-contributing.html#style[Code Style] for the
|
||||
instruction how to set up command line tool that uses this formatter.
|
||||
The Eclipse plugin is provided that allows to format with the same
|
||||
|
@ -2663,9 +2663,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
throws Exception {
|
||||
ChangeInfo c = gApi.changes().id(changeId).get(EnumSet.of(ListChangesOption.DETAILED_LABELS));
|
||||
Set<ReviewerState> states =
|
||||
c.reviewers
|
||||
.entrySet()
|
||||
.stream()
|
||||
c.reviewers.entrySet().stream()
|
||||
.filter(e -> e.getValue().stream().anyMatch(a -> a._accountId == accountId.get()))
|
||||
.map(e -> e.getKey())
|
||||
.collect(toSet());
|
||||
|
@ -206,11 +206,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
||||
setApiUser(admin);
|
||||
gApi.changes().id(changeId).reviewer(user.username).deleteVote("Code-Review");
|
||||
Optional<ApprovalInfo> crUser =
|
||||
get(changeId, DETAILED_LABELS)
|
||||
.labels
|
||||
.get("Code-Review")
|
||||
.all
|
||||
.stream()
|
||||
get(changeId, DETAILED_LABELS).labels.get("Code-Review").all.stream()
|
||||
.filter(a -> a._accountId == user.id.get())
|
||||
.findFirst();
|
||||
assertThat(crUser.isPresent()).isTrue();
|
||||
@ -225,13 +221,8 @@ public class RevisionIT extends AbstractDaemonTest {
|
||||
revision(r).review(in);
|
||||
|
||||
ApprovalInfo cr =
|
||||
gApi.changes()
|
||||
.id(changeId)
|
||||
.get(EnumSet.of(ListChangesOption.DETAILED_LABELS))
|
||||
.labels
|
||||
.get("Code-Review")
|
||||
.all
|
||||
.stream()
|
||||
gApi.changes().id(changeId).get(EnumSet.of(ListChangesOption.DETAILED_LABELS)).labels
|
||||
.get("Code-Review").all.stream()
|
||||
.filter(a -> a._accountId == user.getId().get())
|
||||
.findFirst()
|
||||
.get();
|
||||
|
@ -66,11 +66,7 @@ public abstract class AbstractReindexTests extends StandaloneSiteTest {
|
||||
.containsExactly(adminId.get());
|
||||
// Query group index
|
||||
assertThat(
|
||||
gApi.groups()
|
||||
.query("Group")
|
||||
.withOption(MEMBERS)
|
||||
.get()
|
||||
.stream()
|
||||
gApi.groups().query("Group").withOption(MEMBERS).get().stream()
|
||||
.flatMap(g -> g.members.stream())
|
||||
.map(a -> a._accountId))
|
||||
.containsExactly(adminId.get());
|
||||
|
@ -310,8 +310,7 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
||||
|
||||
// Change status in NoteDb.
|
||||
PatchSetState patchSetState = draftStatus ? PatchSetState.DRAFT : PatchSetState.PUBLISHED;
|
||||
patchSets
|
||||
.stream()
|
||||
patchSets.stream()
|
||||
.map(PatchSet::getId)
|
||||
.map(ctx::getUpdate)
|
||||
.forEach(changeUpdate -> changeUpdate.setPatchSetState(patchSetState));
|
||||
|
@ -451,8 +451,7 @@ public class SuggestReviewersIT extends AbstractDaemonTest {
|
||||
List<TestAccount> expectedUsers,
|
||||
List<AccountGroup> expectedGroups) {
|
||||
List<Integer> actualAccountIds =
|
||||
actual
|
||||
.stream()
|
||||
actual.stream()
|
||||
.filter(i -> i.account != null)
|
||||
.map(i -> i.account._accountId)
|
||||
.collect(toList());
|
||||
|
@ -35,8 +35,7 @@ public class KillTaskIT extends AbstractDaemonTest {
|
||||
r.consume();
|
||||
|
||||
Optional<String> id =
|
||||
result
|
||||
.stream()
|
||||
result.stream()
|
||||
.filter(t -> "Log File Compressor".equals(t.command))
|
||||
.map(t -> t.id)
|
||||
.findFirst();
|
||||
|
@ -270,8 +270,7 @@ public class NoteDbPrimaryIT extends AbstractDaemonTest {
|
||||
assert_().fail("expected read-only exception");
|
||||
} catch (RestApiException e) {
|
||||
Optional<Throwable> oe =
|
||||
Throwables.getCausalChain(e)
|
||||
.stream()
|
||||
Throwables.getCausalChain(e).stream()
|
||||
.filter(x -> x instanceof OrmRuntimeException)
|
||||
.findFirst();
|
||||
assertThat(oe.isPresent()).named("OrmRuntimeException in causal chain of " + e).isTrue();
|
||||
@ -523,12 +522,7 @@ public class NoteDbPrimaryIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
private List<Account.Id> getReviewers(Change.Id id) throws Exception {
|
||||
return gApi.changes()
|
||||
.id(id.get())
|
||||
.get()
|
||||
.reviewers
|
||||
.values()
|
||||
.stream()
|
||||
return gApi.changes().id(id.get()).get().reviewers.values().stream()
|
||||
.flatMap(Collection::stream)
|
||||
.map(a -> new Account.Id(a._accountId))
|
||||
.collect(toList());
|
||||
|
@ -55,11 +55,8 @@ class ElasticIndexVersionDiscovery {
|
||||
}
|
||||
|
||||
return new JsonParser()
|
||||
.parse(AbstractElasticIndex.getContent(response))
|
||||
.getAsJsonObject()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey().replace(name, ""))
|
||||
.collect(toList());
|
||||
.parse(AbstractElasticIndex.getContent(response)).getAsJsonObject().entrySet().stream()
|
||||
.map(e -> e.getKey().replace(name, ""))
|
||||
.collect(toList());
|
||||
}
|
||||
}
|
||||
|
@ -589,8 +589,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
}
|
||||
|
||||
private static List<byte[]> copyAsBytes(Collection<IndexableField> fields) {
|
||||
return fields
|
||||
.stream()
|
||||
return fields.stream()
|
||||
.map(
|
||||
f -> {
|
||||
BytesRef ref = f.binaryValue();
|
||||
|
@ -27,8 +27,7 @@ public class ModuleOverloader {
|
||||
|
||||
// group candidates by annotation existence
|
||||
Map<Boolean, List<Module>> grouped =
|
||||
overrideCandidates
|
||||
.stream()
|
||||
overrideCandidates.stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(m -> m.getClass().getAnnotation(ModuleImpl.class) != null));
|
||||
|
||||
@ -44,16 +43,14 @@ public class ModuleOverloader {
|
||||
}
|
||||
|
||||
// swipe cache implementation with alternative provided in lib
|
||||
return modules
|
||||
.stream()
|
||||
return modules.stream()
|
||||
.map(
|
||||
m -> {
|
||||
ModuleImpl a = m.getClass().getAnnotation(ModuleImpl.class);
|
||||
if (a == null) {
|
||||
return m;
|
||||
}
|
||||
return overrides
|
||||
.stream()
|
||||
return overrides.stream()
|
||||
.filter(
|
||||
o ->
|
||||
o.getClass()
|
||||
|
@ -182,9 +182,7 @@ public class ReviewerRecommender {
|
||||
|
||||
// Sort results
|
||||
Stream<Entry<Account.Id, MutableDouble>> sorted =
|
||||
reviewerScores
|
||||
.entrySet()
|
||||
.stream()
|
||||
reviewerScores.entrySet().stream()
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()));
|
||||
List<Account.Id> sortedSuggestions = sorted.map(Map.Entry::getKey).collect(toList());
|
||||
return sortedSuggestions;
|
||||
|
@ -223,8 +223,7 @@ public class ReviewersUtil {
|
||||
throws OrmException {
|
||||
try (Timer0.Context ctx = metrics.loadAccountsLatency.start()) {
|
||||
List<SuggestedReviewerInfo> reviewer =
|
||||
accountIds
|
||||
.stream()
|
||||
accountIds.stream()
|
||||
.map(accountLoader::get)
|
||||
.filter(Objects::nonNull)
|
||||
.map(
|
||||
|
@ -269,8 +269,7 @@ public class StarredChangesUtil {
|
||||
public Set<Account.Id> byChange(final Change.Id changeId, final String label)
|
||||
throws OrmException {
|
||||
try (Repository repo = repoManager.openRepository(allUsers)) {
|
||||
return getRefNames(repo, RefNames.refsStarredChangesPrefix(changeId))
|
||||
.stream()
|
||||
return getRefNames(repo, RefNames.refsStarredChangesPrefix(changeId)).stream()
|
||||
.map(Account.Id::parse)
|
||||
.filter(accountId -> hasStar(repo, changeId, accountId, label))
|
||||
.collect(toSet());
|
||||
@ -285,8 +284,7 @@ public class StarredChangesUtil {
|
||||
public Set<Change.Id> byAccount(final Account.Id accountId, final String label)
|
||||
throws OrmException {
|
||||
try (Repository repo = repoManager.openRepository(allUsers)) {
|
||||
return getRefNames(repo, RefNames.REFS_STARRED_CHANGES)
|
||||
.stream()
|
||||
return getRefNames(repo, RefNames.REFS_STARRED_CHANGES).stream()
|
||||
.filter(refPart -> refPart.endsWith("/" + accountId.get()))
|
||||
.map(Change.Id::fromRefPart)
|
||||
.filter(changeId -> hasStar(repo, changeId, accountId, label))
|
||||
|
@ -94,9 +94,7 @@ public class AccountByEmailCacheImpl implements AccountByEmailCache {
|
||||
r.add(a.getId());
|
||||
}
|
||||
for (AccountState accountState : accountQueryProvider.get().byEmailPrefix(email)) {
|
||||
if (accountState
|
||||
.getExternalIds()
|
||||
.stream()
|
||||
if (accountState.getExternalIds().stream()
|
||||
.filter(e -> email.equals(e.email()))
|
||||
.findAny()
|
||||
.isPresent()) {
|
||||
|
@ -185,9 +185,7 @@ public class AccountControl {
|
||||
}
|
||||
|
||||
private Set<AccountGroup.UUID> groupsOf(IdentifiedUser user) {
|
||||
return user.getEffectiveGroups()
|
||||
.getKnownGroups()
|
||||
.stream()
|
||||
return user.getEffectiveGroups().getKnownGroups().stream()
|
||||
.filter(a -> !SystemGroupBackend.isSystemGroup(a))
|
||||
.collect(toSet());
|
||||
}
|
||||
|
@ -395,15 +395,13 @@ public class AccountManager {
|
||||
throws OrmException, AccountException, IOException {
|
||||
try (ReviewDb db = schema.open()) {
|
||||
Collection<ExternalId> filteredExtIdsByScheme =
|
||||
ExternalId.from(db.accountExternalIds().byAccount(to).toList())
|
||||
.stream()
|
||||
ExternalId.from(db.accountExternalIds().byAccount(to).toList()).stream()
|
||||
.filter(e -> e.isScheme(who.getExternalIdKey().scheme()))
|
||||
.collect(toSet());
|
||||
|
||||
if (!filteredExtIdsByScheme.isEmpty()
|
||||
&& (filteredExtIdsByScheme.size() > 1
|
||||
|| !filteredExtIdsByScheme
|
||||
.stream()
|
||||
|| !filteredExtIdsByScheme.stream()
|
||||
.filter(e -> e.key().equals(who.getExternalIdKey()))
|
||||
.findAny()
|
||||
.isPresent())) {
|
||||
|
@ -178,10 +178,7 @@ public class AccountResolver {
|
||||
|
||||
// At this point we have no clue. Just perform a whole bunch of suggestions
|
||||
// and pray we come up with a reasonable result list.
|
||||
return accountQueryProvider
|
||||
.get()
|
||||
.byDefault(nameOrEmail)
|
||||
.stream()
|
||||
return accountQueryProvider.get().byDefault(nameOrEmail).stream()
|
||||
.map(a -> a.getAccount().getId())
|
||||
.collect(toSet());
|
||||
}
|
||||
|
@ -74,8 +74,7 @@ public class ChangeUserName implements Callable<VoidResult> {
|
||||
throws OrmException, NameAlreadyUsedException, InvalidUserNameException, IOException,
|
||||
ConfigInvalidException {
|
||||
Collection<ExternalId> old =
|
||||
ExternalId.from(db.accountExternalIds().byAccount(user.getAccountId()).toList())
|
||||
.stream()
|
||||
ExternalId.from(db.accountExternalIds().byAccount(user.getAccountId()).toList()).stream()
|
||||
.filter(e -> e.isScheme(SCHEME_USERNAME))
|
||||
.collect(toSet());
|
||||
if (!old.isEmpty()) {
|
||||
|
@ -75,12 +75,7 @@ public class DeleteEmail implements RestModifyView<AccountResource.Email, Input>
|
||||
}
|
||||
|
||||
Set<ExternalId> extIds =
|
||||
dbProvider
|
||||
.get()
|
||||
.accountExternalIds()
|
||||
.byAccount(user.getAccountId())
|
||||
.toList()
|
||||
.stream()
|
||||
dbProvider.get().accountExternalIds().byAccount(user.getAccountId()).toList().stream()
|
||||
.map(ExternalId::from)
|
||||
.filter(e -> email.equals(e.email()))
|
||||
.collect(toSet());
|
||||
|
@ -70,11 +70,7 @@ public class DeleteExternalIds implements RestModifyView<AccountResource, List<S
|
||||
|
||||
Account.Id accountId = resource.getUser().getAccountId();
|
||||
Map<ExternalId.Key, ExternalId> externalIdMap =
|
||||
dbProvider
|
||||
.get()
|
||||
.accountExternalIds()
|
||||
.byAccount(resource.getUser().getAccountId())
|
||||
.toList()
|
||||
dbProvider.get().accountExternalIds().byAccount(resource.getUser().getAccountId()).toList()
|
||||
.stream()
|
||||
.map(ExternalId::from)
|
||||
.collect(toMap(i -> i.key(), i -> i));
|
||||
|
@ -63,8 +63,7 @@ public class DeleteWatchedProjects
|
||||
Account.Id accountId = rsrc.getUser().getAccountId();
|
||||
watchConfig.deleteProjectWatches(
|
||||
accountId,
|
||||
input
|
||||
.stream()
|
||||
input.stream()
|
||||
.map(w -> ProjectWatchKey.create(new Project.NameKey(w.project), w.filter))
|
||||
.collect(toList()));
|
||||
accountCache.evict(accountId);
|
||||
|
@ -65,9 +65,7 @@ public class InternalGroupBackend implements GroupBackend {
|
||||
|
||||
@Override
|
||||
public Collection<GroupReference> suggest(final String name, final ProjectControl project) {
|
||||
return groupCache
|
||||
.all()
|
||||
.stream()
|
||||
return groupCache.all().stream()
|
||||
.filter(
|
||||
group ->
|
||||
// startsWithIgnoreCase && isVisible
|
||||
|
@ -222,8 +222,7 @@ public class UniversalGroupBackend implements GroupBackend {
|
||||
@Override
|
||||
public void check() throws StartupException {
|
||||
String invalid =
|
||||
cfg.getSubsections("groups")
|
||||
.stream()
|
||||
cfg.getSubsections("groups").stream()
|
||||
.filter(
|
||||
sub -> {
|
||||
AccountGroup.UUID uuid = new AccountGroup.UUID(sub);
|
||||
|
@ -412,8 +412,7 @@ public class ChangeInserter implements InsertChangeOp {
|
||||
|
||||
private Set<Account.Id> filterOnChangeVisibility(
|
||||
final ReviewDb db, final ChangeNotes notes, Set<Account.Id> accounts) {
|
||||
return accounts
|
||||
.stream()
|
||||
return accounts.stream()
|
||||
.filter(
|
||||
accountId -> {
|
||||
try {
|
||||
|
@ -771,9 +771,7 @@ public class ChangeJson {
|
||||
Maps.newHashMapWithExpectedSize(permittedLabels.size());
|
||||
for (String label : permittedLabels.keySet()) {
|
||||
List<Integer> permittedVotingRange =
|
||||
permittedLabels
|
||||
.get(label)
|
||||
.stream()
|
||||
permittedLabels.get(label).stream()
|
||||
.map(this::parseRangeValue)
|
||||
.filter(java.util.Objects::nonNull)
|
||||
.sorted()
|
||||
@ -867,9 +865,7 @@ public class ChangeJson {
|
||||
}
|
||||
|
||||
if (detailed) {
|
||||
labels
|
||||
.entrySet()
|
||||
.stream()
|
||||
labels.entrySet().stream()
|
||||
.filter(e -> labelTypes.byLabel(e.getKey()) != null)
|
||||
.forEach(e -> setLabelValues(labelTypes.byLabel(e.getKey()), e.getValue()));
|
||||
}
|
||||
@ -1090,8 +1086,7 @@ public class ChangeJson {
|
||||
}
|
||||
|
||||
private Collection<AccountInfo> toAccountInfo(Collection<Account.Id> accounts) {
|
||||
return accounts
|
||||
.stream()
|
||||
return accounts.stream()
|
||||
.map(accountLoader::get)
|
||||
.sorted(AccountInfoComparator.ORDER_NULLS_FIRST)
|
||||
.collect(toList());
|
||||
|
@ -897,17 +897,13 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
}
|
||||
|
||||
private Set<CommentSetEntry> readExistingComments(ChangeContext ctx) throws OrmException {
|
||||
return commentsUtil
|
||||
.publishedByChange(ctx.getDb(), ctx.getNotes())
|
||||
.stream()
|
||||
return commentsUtil.publishedByChange(ctx.getDb(), ctx.getNotes()).stream()
|
||||
.map(CommentSetEntry::create)
|
||||
.collect(toSet());
|
||||
}
|
||||
|
||||
private Set<CommentSetEntry> readExistingRobotComments(ChangeContext ctx) throws OrmException {
|
||||
return commentsUtil
|
||||
.robotCommentsByChange(ctx.getNotes())
|
||||
.stream()
|
||||
return commentsUtil.robotCommentsByChange(ctx.getNotes()).stream()
|
||||
.map(CommentSetEntry::create)
|
||||
.collect(toSet());
|
||||
}
|
||||
@ -1166,8 +1162,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
if (!reduced.isEmpty()) {
|
||||
throw new ResourceConflictException(
|
||||
"Cannot reduce vote on labels for closed change: "
|
||||
+ reduced
|
||||
.stream()
|
||||
+ reduced.stream()
|
||||
.map(p -> p.getLabel())
|
||||
.distinct()
|
||||
.sorted()
|
||||
|
@ -695,9 +695,7 @@ public class ReceiveCommits {
|
||||
}
|
||||
|
||||
List<ReplaceRequest> updated =
|
||||
replaceByChange
|
||||
.values()
|
||||
.stream()
|
||||
replaceByChange.values().stream()
|
||||
.filter(r -> !r.skip && r.inputCommand.getResult() == OK)
|
||||
.sorted(comparingInt(r -> r.notes.getChangeId().get()))
|
||||
.collect(toList());
|
||||
|
@ -563,8 +563,7 @@ public class ChangeField {
|
||||
|
||||
@VisibleForTesting
|
||||
static List<SubmitRecord> parseSubmitRecords(Collection<String> values) {
|
||||
return values
|
||||
.stream()
|
||||
return values.stream()
|
||||
.map(v -> GSON.fromJson(v, StoredSubmitRecord.class).toSubmitRecord())
|
||||
.collect(toList());
|
||||
}
|
||||
|
@ -181,8 +181,7 @@ public class MailProcessor {
|
||||
// comments from the outbound email.
|
||||
// TODO(hiesel) Also filter by original comment author.
|
||||
Collection<Comment> comments =
|
||||
cd.publishedComments()
|
||||
.stream()
|
||||
cd.publishedComments().stream()
|
||||
.filter(c -> (c.writtenOn.getTime() / 1000) == (metadata.timestamp.getTime() / 1000))
|
||||
.sorted(CommentsUtil.COMMENT_ORDER)
|
||||
.collect(toList());
|
||||
@ -349,8 +348,7 @@ public class MailProcessor {
|
||||
|
||||
private Set<String> existingMessageIds(ChangeData cd) throws OrmException {
|
||||
Set<String> existingMessageIds = new HashSet<>();
|
||||
cd.messages()
|
||||
.stream()
|
||||
cd.messages().stream()
|
||||
.forEach(
|
||||
m -> {
|
||||
String messageId = CommentsUtil.extractMessageId(m.getTag());
|
||||
@ -358,8 +356,7 @@ public class MailProcessor {
|
||||
existingMessageIds.add(messageId);
|
||||
}
|
||||
});
|
||||
cd.publishedComments()
|
||||
.stream()
|
||||
cd.publishedComments().stream()
|
||||
.forEach(
|
||||
c -> {
|
||||
String messageId = CommentsUtil.extractMessageId(c.tag);
|
||||
|
@ -86,10 +86,7 @@ public class RawMailParser {
|
||||
}
|
||||
|
||||
// Add additional headers
|
||||
mimeMessage
|
||||
.getHeader()
|
||||
.getFields()
|
||||
.stream()
|
||||
mimeMessage.getHeader().getFields().stream()
|
||||
.filter(f -> !MAIN_HEADERS.contains(f.getName().toLowerCase()))
|
||||
.forEach(f -> messageBuilder.addAdditionalHeader(f.getName() + ": " + f.getBody()));
|
||||
|
||||
|
@ -522,8 +522,7 @@ public class CommentSender extends ReplyToChangeSender {
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> commentBlocksToSoyData(List<CommentFormatter.Block> blocks) {
|
||||
return blocks
|
||||
.stream()
|
||||
return blocks.stream()
|
||||
.map(
|
||||
b -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
@ -705,9 +705,7 @@ public class ChangeBundle {
|
||||
private static boolean createdOnIsMonotonic(
|
||||
Map<?, PatchSet> patchSets, Set<PatchSet.Id> limitToIds) {
|
||||
List<PatchSet> orderedById =
|
||||
patchSets
|
||||
.values()
|
||||
.stream()
|
||||
patchSets.values().stream()
|
||||
.filter(ps -> limitToIds.contains(ps.getId()))
|
||||
.sorted(ChangeUtil.PS_ID_ORDER)
|
||||
.collect(toList());
|
||||
|
@ -409,9 +409,7 @@ public class ChangeRebuilderImpl extends ChangeRebuilder {
|
||||
|
||||
private static List<Comment> getComments(
|
||||
ChangeBundle bundle, String serverId, PatchLineComment.Status status, PatchSet ps) {
|
||||
return bundle
|
||||
.getPatchLineComments()
|
||||
.stream()
|
||||
return bundle.getPatchLineComments().stream()
|
||||
.filter(c -> c.getPatchSetId().equals(ps.getId()) && c.getStatus() == status)
|
||||
.map(plc -> plc.asComment(serverId))
|
||||
.sorted(CommentsUtil.COMMENT_ORDER)
|
||||
|
@ -180,8 +180,7 @@ public class DeleteRef {
|
||||
List<String> refs =
|
||||
prefix == null
|
||||
? refsToDelete
|
||||
: refsToDelete
|
||||
.stream()
|
||||
: refsToDelete.stream()
|
||||
.map(ref -> ref.startsWith(prefix) ? ref : prefix + ref)
|
||||
.collect(toList());
|
||||
for (String ref : refs) {
|
||||
|
@ -216,8 +216,7 @@ public class ProjectCacheImpl implements ProjectCache {
|
||||
|
||||
@Override
|
||||
public Set<AccountGroup.UUID> guessRelevantGroupUUIDs() {
|
||||
return all()
|
||||
.stream()
|
||||
return all().stream()
|
||||
.map(n -> byName.getIfPresent(n.get()))
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(p -> p.getConfig().getAllGroupUUIDs().stream())
|
||||
|
@ -937,8 +937,7 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
@Operator
|
||||
public Predicate<ChangeData> reviewer(String who) throws QueryParseException, OrmException {
|
||||
return Predicate.or(
|
||||
parseAccount(who)
|
||||
.stream()
|
||||
parseAccount(who).stream()
|
||||
.map(id -> ReviewerPredicate.reviewer(args, id))
|
||||
.collect(toList()));
|
||||
}
|
||||
@ -1135,11 +1134,7 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
private Set<Account.Id> getMembers(AccountGroup.UUID g) throws OrmException {
|
||||
Set<Account.Id> accounts;
|
||||
Set<Account.Id> allMembers =
|
||||
args.listMembers
|
||||
.get()
|
||||
.setRecursive(true)
|
||||
.apply(g)
|
||||
.stream()
|
||||
args.listMembers.get().setRecursive(true).apply(g).stream()
|
||||
.map(a -> new Account.Id(a._accountId))
|
||||
.collect(toSet());
|
||||
int maxTerms = args.indexConfig.maxTerms();
|
||||
|
@ -31,8 +31,7 @@ class SubmitRecordPredicate extends ChangeIndexPredicate {
|
||||
return new SubmitRecordPredicate(status.name() + ',' + lowerLabel);
|
||||
}
|
||||
return Predicate.or(
|
||||
accounts
|
||||
.stream()
|
||||
accounts.stream()
|
||||
.map(a -> new SubmitRecordPredicate(status.name() + ',' + lowerLabel + ',' + a.get()))
|
||||
.collect(toList()));
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ class SubmittablePredicate extends ChangeIndexPredicate {
|
||||
|
||||
@Override
|
||||
public boolean match(ChangeData cd) throws OrmException {
|
||||
return cd.submitRecords(ChangeField.SUBMIT_RULE_OPTIONS_STRICT)
|
||||
.stream()
|
||||
return cd.submitRecords(ChangeField.SUBMIT_RULE_OPTIONS_STRICT).stream()
|
||||
.anyMatch(r -> r.status == status);
|
||||
}
|
||||
|
||||
|
@ -76,11 +76,8 @@ public class Schema_135 extends SchemaVersion {
|
||||
|
||||
Set<GroupReference> groups =
|
||||
Stream.concat(
|
||||
config
|
||||
.getAccessSection(AccessSection.GLOBAL_CAPABILITIES, true)
|
||||
.getPermission(GlobalCapability.ADMINISTRATE_SERVER, true)
|
||||
.getRules()
|
||||
.stream()
|
||||
config.getAccessSection(AccessSection.GLOBAL_CAPABILITIES, true)
|
||||
.getPermission(GlobalCapability.ADMINISTRATE_SERVER, true).getRules().stream()
|
||||
.map(PermissionRule::getGroup),
|
||||
Stream.of(systemGroupBackend.getGroup(PROJECT_OWNERS)))
|
||||
.filter(g -> createRefsMetaConfigPermission.getRule(g) == null)
|
||||
|
@ -109,8 +109,7 @@ public class ChangeFieldTest extends GerritBaseTests {
|
||||
private static void assertStoredRecordRoundTrip(SubmitRecord... records) {
|
||||
List<SubmitRecord> recordList = ImmutableList.copyOf(records);
|
||||
List<String> stored =
|
||||
ChangeField.storedSubmitRecords(recordList)
|
||||
.stream()
|
||||
ChangeField.storedSubmitRecords(recordList).stream()
|
||||
.map(s -> new String(s, UTF_8))
|
||||
.collect(toList());
|
||||
assertThat(ChangeField.parseSubmitRecords(stored))
|
||||
|
@ -1772,10 +1772,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
gApi.groups().id(group).addMembers(user2.toString(), user3.toString());
|
||||
|
||||
List<String> members =
|
||||
gApi.groups()
|
||||
.id(group)
|
||||
.members()
|
||||
.stream()
|
||||
gApi.groups().id(group).members().stream()
|
||||
.map(a -> a._accountId.toString())
|
||||
.collect(toList());
|
||||
assertThat(members).contains(user2.toString());
|
||||
@ -2075,8 +2072,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
expectedStates.add("All-Users:refs/draft-comments/" + cs + "/" + u);
|
||||
}
|
||||
assertThat(
|
||||
cd.getRefStates()
|
||||
.stream()
|
||||
cd.getRefStates().stream()
|
||||
.map(String::new)
|
||||
// Omit SHA-1, we're just concerned with the project/ref names.
|
||||
.map(s -> s.substring(0, s.lastIndexOf(':')))
|
||||
|
@ -134,8 +134,7 @@ public class FakeEmailSender implements EmailSender {
|
||||
public List<Message> getMessages(String changeId, String type) {
|
||||
final String idFooter = "\nGerrit-Change-Id: " + changeId + "\n";
|
||||
final String typeFooter = "\nGerrit-MessageType: " + type + "\n";
|
||||
return getMessages()
|
||||
.stream()
|
||||
return getMessages().stream()
|
||||
.filter(in -> in.body().contains(idFooter) && in.body().contains(typeFooter))
|
||||
.collect(toList());
|
||||
}
|
||||
|
@ -102,9 +102,7 @@ public class ChangeArgumentParser {
|
||||
|
||||
private List<ChangeControl> changeFromNotesFactory(String id, CurrentUser currentUser)
|
||||
throws OrmException, UnloggedFailure {
|
||||
return changeNotesFactory
|
||||
.create(db, parseId(id))
|
||||
.stream()
|
||||
return changeNotesFactory.create(db, parseId(id)).stream()
|
||||
.map(changeNote -> controlForChange(changeNote, currentUser))
|
||||
.filter(changeControl -> changeControl.isPresent())
|
||||
.map(changeControl -> changeControl.get())
|
||||
|
@ -128,8 +128,7 @@ public class SetMembersCommand extends SshCommand {
|
||||
String action, GroupResource group, List<Account.Id> accountIdList)
|
||||
throws UnsupportedEncodingException, IOException {
|
||||
String names =
|
||||
accountIdList
|
||||
.stream()
|
||||
accountIdList.stream()
|
||||
.map(
|
||||
accountId ->
|
||||
MoreObjects.firstNonNull(
|
||||
|
@ -17,7 +17,7 @@
|
||||
set -eu
|
||||
|
||||
# Keep this version in sync with dev-contributing.txt.
|
||||
VERSION=${1:-1.6}
|
||||
VERSION=${1:-1.7}
|
||||
|
||||
case "$VERSION" in
|
||||
1.3)
|
||||
|
Loading…
Reference in New Issue
Block a user