diff options
author | Pierre <pierre.guillot@sonarsource.com> | 2023-07-06 16:12:30 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-07-17 20:03:44 +0000 |
commit | a0f29cb5c393c912f45c4d4e7f4c8a5679162b0d (patch) | |
tree | 4dd5c0622c70c639dac142701aa3cbcb45eb5e86 /server/sonar-server-common | |
parent | 5737b08804feb53257e712443b2eb69ab4607f47 (diff) | |
download | sonarqube-a0f29cb5c393c912f45c4d4e7f4c8a5679162b0d.tar.gz sonarqube-a0f29cb5c393c912f45c4d4e7f4c8a5679162b0d.zip |
NO-JIRA replace MoreCollectors.toList with Collectors.toList
Diffstat (limited to 'server/sonar-server-common')
7 files changed, 15 insertions, 16 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/ComponentTextSearchFeatureRepertoire.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/ComponentTextSearchFeatureRepertoire.java index 76695def76b..884e078b6c0 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/ComponentTextSearchFeatureRepertoire.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/ComponentTextSearchFeatureRepertoire.java @@ -23,12 +23,12 @@ import java.util.List; import java.util.Locale; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.lang.StringUtils; import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.MatchQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; -import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.es.newindex.DefaultIndexSettings; import org.sonar.server.es.newindex.DefaultIndexSettingsElement; import org.sonar.server.es.textsearch.ComponentTextSearchQueryFactory.ComponentTextSearchQuery; @@ -71,7 +71,7 @@ public enum ComponentTextSearchFeatureRepertoire implements ComponentTextSearchF if (tokens.isEmpty()) { return Stream.empty(); } - List<String> lowerCaseTokens = tokens.stream().map(t -> t.toLowerCase(Locale.ENGLISH)).collect(MoreCollectors.toList()); + List<String> lowerCaseTokens = tokens.stream().map(t -> t.toLowerCase(Locale.ENGLISH)).collect(Collectors.toList()); BoolQueryBuilder queryBuilder = prefixAndPartialQuery(lowerCaseTokens, query.getFieldName(), SEARCH_PREFIX_CASE_INSENSITIVE_ANALYZER) .boost(2F); return Stream.of(queryBuilder); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/JavaTokenizer.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/JavaTokenizer.java index 8608b1e7fd4..c768f273364 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/JavaTokenizer.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/textsearch/JavaTokenizer.java @@ -21,8 +21,8 @@ package org.sonar.server.es.textsearch; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import org.apache.commons.lang.StringUtils; -import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.es.newindex.DefaultIndexSettings; import static org.sonar.server.es.newindex.DefaultIndexSettings.MINIMUM_NGRAM_LENGTH; @@ -41,6 +41,6 @@ public class JavaTokenizer { queryText.split(DefaultIndexSettings.SEARCH_TERM_TOKENIZER_PATTERN)) .filter(StringUtils::isNotEmpty) .filter(s -> s.length() >= MINIMUM_NGRAM_LENGTH) - .collect(MoreCollectors.toList()); + .collect(Collectors.toList()); } } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/measure/index/ProjectMeasuresDoc.java b/server/sonar-server-common/src/main/java/org/sonar/server/measure/index/ProjectMeasuresDoc.java index a63ebea4cc8..8ad8c6f080e 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/measure/index/ProjectMeasuresDoc.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/measure/index/ProjectMeasuresDoc.java @@ -25,9 +25,9 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.es.BaseDoc; import org.sonar.server.permission.index.AuthorizationDoc; @@ -121,7 +121,7 @@ public class ProjectMeasuresDoc extends BaseDoc { .map(entry -> ImmutableMap.<String, Object>of( SUB_FIELD_MEASURES_KEY, entry.getKey(), SUB_FIELD_MEASURES_VALUE, entry.getValue())) - .collect(MoreCollectors.toList())); + .collect(Collectors.toList())); return this; } @@ -145,7 +145,7 @@ public class ProjectMeasuresDoc extends BaseDoc { .map(entry -> ImmutableMap.<String, Object>of( SUB_FIELD_DISTRIB_LANGUAGE, entry.getKey(), SUB_FIELD_DISTRIB_NCLOC, entry.getValue())) - .collect(MoreCollectors.toList())); + .collect(Collectors.toList())); return this; } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java index 2fff25c259e..85cadce0d8b 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.function.Function; +import java.util.stream.Collectors; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.apache.lucene.search.join.ScoreMode; @@ -54,7 +55,6 @@ import org.sonar.api.rule.RuleStatus; import org.sonar.api.rule.Severity; import org.sonar.api.rules.RuleType; import org.sonar.api.utils.System2; -import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.qualityprofile.QProfileDto; import org.sonar.server.es.EsClient; import org.sonar.server.es.EsUtils; @@ -142,7 +142,7 @@ public class RuleIndex { public static final List<String> ALL_STATUSES_EXCEPT_REMOVED = Arrays.stream(RuleStatus.values()) .filter(status -> !RuleStatus.REMOVED.equals(status)) .map(RuleStatus::toString) - .collect(MoreCollectors.toList()); + .collect(Collectors.toList()); private static final String AGGREGATION_NAME_FOR_TAGS = "tagsAggregation"; @@ -290,7 +290,7 @@ public class RuleIndex { Collection<RuleType> types = query.getTypes(); if (isNotEmpty(types)) { - List<String> typeNames = types.stream().map(RuleType::toString).collect(MoreCollectors.toList()); + List<String> typeNames = types.stream().map(RuleType::toString).collect(Collectors.toList()); filters.put(FIELD_RULE_TYPE, QueryBuilders.termsQuery(FIELD_RULE_TYPE, typeNames)); } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java b/server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java index 1ab2cdda6c7..16377c9201b 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java @@ -41,7 +41,6 @@ import static java.util.Arrays.stream; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; import static org.sonar.api.server.rule.RulesDefinition.PciDssVersion.V3_2; -import static org.sonar.core.util.stream.MoreCollectors.toList; import static org.sonar.core.util.stream.MoreCollectors.toSet; import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; import static org.sonar.server.security.SecurityStandards.VulnerabilityProbability.HIGH; @@ -394,7 +393,7 @@ public final class SecurityStandards { .stream() .filter(k -> cwe.stream().anyMatch(CWES_BY_SQ_CATEGORY.get(k)::contains)) .sorted(SQ_CATEGORY_ORDERING) - .collect(toList()); + .collect(Collectors.toList()); return result.isEmpty() ? singletonList(SQCategory.OTHERS) : result; } diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java index b62a495ad97..49a5317af00 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebHooksImpl.java @@ -22,6 +22,7 @@ package org.sonar.server.webhook; import java.util.List; import java.util.Optional; import java.util.function.Supplier; +import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -30,7 +31,6 @@ import org.sonar.api.ce.posttask.PostProjectAnalysisTask; import org.sonar.api.server.ServerSide; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.project.ProjectDto; @@ -106,7 +106,7 @@ public class WebHooksImpl implements WebHooks { List<Webhook> webhooks = readWebHooksFrom(analysis.projectUuid(), taskLogStatistics) .map(dto -> new Webhook(dto.getUuid(), analysis.projectUuid(), analysis.ceTaskUuid(), analysis.analysisUuid(), dto.getName(), dto.getUrl(), dto.getSecret())) - .collect(MoreCollectors.toList()); + .collect(Collectors.toList()); if (webhooks.isEmpty()) { return; } diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java index ca91823fd30..f075779be84 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowForSecurityHotspotsTest.java @@ -26,6 +26,7 @@ import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nullable; import org.apache.commons.lang.time.DateUtils; @@ -36,7 +37,6 @@ import org.sonar.api.rule.RuleKey; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.FieldDiffs; import org.sonar.core.issue.IssueChangeContext; -import org.sonar.core.util.stream.MoreCollectors; import org.sonar.server.issue.IssueFieldsSetter; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; @@ -293,7 +293,7 @@ public class IssueWorkflowForSecurityHotspotsTest { } private Collection<String> keys(List<Transition> transitions) { - return transitions.stream().map(Transition::key).collect(MoreCollectors.toList()); + return transitions.stream().map(Transition::key).collect(Collectors.toList()); } private static void setStatusPreviousToClosed(DefaultIssue hotspot, String previousStatus, @Nullable String previousResolution, @Nullable String newResolution) { |