aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2023-07-06 16:16:51 +0200
committersonartech <sonartech@sonarsource.com>2023-07-17 20:03:44 +0000
commitb3b0e8a33f1ce672b54e75c7e14e4b708285e64f (patch)
treeeb8349e215ed414e5369e36826eec18eedd6c8fb
parenta0f29cb5c393c912f45c4d4e7f4c8a5679162b0d (diff)
downloadsonarqube-b3b0e8a33f1ce672b54e75c7e14e4b708285e64f.tar.gz
sonarqube-b3b0e8a33f1ce672b54e75c7e14e4b708285e64f.zip
NO-JIRA replace MoreCollectors.toSet with Collectors.toSet
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/QGToEvaluatedQG.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerExecution.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulatorTest.java3
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java3
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java3
-rw-r--r--server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoIT.java13
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java9
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/DBSessionsImplTest.java5
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/BuiltIndex.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java13
-rw-r--r--server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java8
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java7
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java9
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/AppNodeClusterCheck.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssueChangeWSSupport.java7
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TransitionAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java9
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ValidRatingMetrics.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandler.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileRepositoryImpl.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileUpdateImpl.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddGroupAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddUserAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ExportAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveGroupAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveUserAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchData.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java4
-rw-r--r--server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebServiceFilter.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java3
-rw-r--r--sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java6
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java5
53 files changed, 104 insertions, 136 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/QGToEvaluatedQG.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/QGToEvaluatedQG.java
index 05b3b8717f8..38f7bae71c6 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/QGToEvaluatedQG.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/api/posttask/QGToEvaluatedQG.java
@@ -21,10 +21,10 @@ package org.sonar.ce.task.projectanalysis.api.posttask;
import java.util.Set;
import java.util.function.Function;
+import java.util.stream.Collectors;
import org.sonar.api.ce.posttask.QualityGate;
import org.sonar.api.ce.posttask.QualityGate.EvaluationStatus;
import org.sonar.api.measures.Metric;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.server.qualitygate.Condition;
import org.sonar.server.qualitygate.EvaluatedCondition;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
@@ -47,7 +47,7 @@ public class QGToEvaluatedQG implements Function<QualityGate, EvaluatedQualityGa
q.getStatus() == EvaluationStatus.NO_VALUE ? null : q.getValue());
return condition;
})
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
return builder.setQualityGate(new org.sonar.server.qualitygate.QualityGate(qg.getId(), qg.getName(), conditions))
.setStatus(Metric.Level.valueOf(qg.getStatus().name()))
.build();
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerExecution.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerExecution.java
index 1883907fde0..4918cf28de8 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerExecution.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerExecution.java
@@ -20,6 +20,7 @@
package org.sonar.ce.task.projectanalysis.issue;
import java.util.Set;
+import java.util.stream.Collectors;
import org.sonar.api.issue.Issue;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.component.Component;
@@ -28,7 +29,6 @@ import org.sonar.core.issue.tracking.Input;
import org.sonar.core.issue.tracking.NonClosedTracking;
import org.sonar.core.issue.tracking.Tracker;
import org.sonar.core.issue.tracking.Tracking;
-import org.sonar.core.util.stream.MoreCollectors;
public class TrackerExecution {
@@ -63,7 +63,7 @@ public class TrackerExecution {
// - recover fields values from before they were closed
Set<DefaultIssue> matchesClosedIssues = closedIssuesTracking.getMatchedRaws().values().stream()
.filter(t -> Issue.STATUS_CLOSED.equals(t.getStatus()))
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
componentIssuesLoader.loadLatestDiffChangesForReopeningOfClosedIssues(matchesClosedIssues);
return closedIssuesTracking;
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulatorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulatorTest.java
index 9f9e0f78064..cf8a9168ec1 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulatorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulatorTest.java
@@ -30,7 +30,6 @@ import org.sonar.ce.task.CeTask;
import org.sonar.ce.task.projectanalysis.step.PersistComponentsStep;
import org.sonar.ce.task.projectanalysis.task.ListTaskContainer;
import org.sonar.ce.task.step.ComputationStep;
-import org.sonar.core.util.stream.MoreCollectors;
import static com.google.common.collect.Sets.difference;
import static org.assertj.core.api.Assertions.assertThat;
@@ -66,7 +65,7 @@ public class ProjectAnalysisTaskContainerPopulatorTest {
.filter(Objects::nonNull)
.filter(ComputationStep.class::isAssignableFrom)
.map(Class::getCanonicalName)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
assertThat(difference(retrieveStepPackageStepsCanonicalNames(PROJECTANALYSIS_STEP_PACKAGE), computationStepClassNames)).isEmpty();
}
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java
index 2786a0cb82f..a3c3a3b8334 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.locks.Lock;
+import java.util.stream.Collectors;
import org.sonar.api.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +58,7 @@ public class CeDistributedInformationImpl implements CeDistributedInformation, S
.filter(e -> connectedWorkerUUIDs.contains(e.getKey()))
.map(Map.Entry::getValue)
.flatMap(Set::stream)
- .collect(toSet());
+ .collect(Collectors.toSet());
}
@Override
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java
index ec7f64a3fe7..e2bb853815a 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java
@@ -39,7 +39,6 @@ import org.sonar.ce.configuration.CeConfiguration;
import org.sonar.ce.taskprocessor.CeWorker;
import org.sonar.ce.taskprocessor.CeWorkerController;
import org.sonar.ce.taskprocessor.CeWorkerFactory;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.process.Jmx;
import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
@@ -64,7 +63,7 @@ public class CeTasksMBeanImplTest {
when(res.getUUID()).thenReturn(uuid);
return res;
})
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
private final CeWorkerController ceWorkerController = mock(CeWorkerController.class);
private final CeTasksMBeanImpl underTest = new CeTasksMBeanImpl(new DumbCEQueueStatus(), new DumbCeConfiguration(), new DumbCeWorkerFactory(), ceWorkerController);
diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoIT.java
index b9fad2cc71b..348c2b2583a 100644
--- a/server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoIT.java
+++ b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoIT.java
@@ -33,7 +33,6 @@ import org.junit.Test;
import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
import org.sonar.core.util.Uuids;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
import org.sonar.db.EmailSubscriberDto;
@@ -79,13 +78,13 @@ public class AuthorizationDaoIT {
group2 = db.users().insertGroup("group2");
randomExistingUserUuids = IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
.mapToObj(i -> db.users().insertUser().getUuid())
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
randomPublicEntityUuids = IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
.mapToObj(i -> db.components().insertPublicProject().getProjectDto().getUuid())
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
randomPrivateEntityUuids = IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
.mapToObj(i -> db.components().insertPrivateProject().getProjectDto().getUuid())
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
}
/**
@@ -232,7 +231,7 @@ public class AuthorizationDaoIT {
public void keepAuthorizedEntityUuids_returns_empty_for_group_AnyOne_for_non_existent_projects() {
Set<String> randomNonProjectsSet = IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
.mapToObj(i -> Integer.toString(3_562 + i))
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
assertThat(underTest.keepAuthorizedEntityUuids(dbSession, randomNonProjectsSet, null, UserRole.USER))
.isEmpty();
@@ -242,7 +241,7 @@ public class AuthorizationDaoIT {
public void keepAuthorizedEntityUuids_returns_empty_for_user_for_non_existent_projects() {
Set<String> randomNonProjectsSet = IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
.mapToObj(i -> Integer.toString(9_666 + i))
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
assertThat(underTest.keepAuthorizedEntityUuids(dbSession, randomNonProjectsSet, user.getUuid(), UserRole.USER))
.isEmpty();
@@ -495,7 +494,7 @@ public class AuthorizationDaoIT {
ProjectDto project = random.nextBoolean() ? db.components().insertPublicProject().getProjectDto() : db.components().insertPrivateProject().getProjectDto();
Set<String> randomNonExistingUserUuidsSet = IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
.mapToObj(i -> Uuids.createFast())
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
assertThat(underTest.keepAuthorizedUsersForRoleAndEntity(dbSession, randomNonExistingUserUuidsSet, UserRole.USER, project.getUuid()))
.isEmpty();
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
index 8fd1c9ed34c..daf1ddd183d 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.TimeUtils;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.Dao;
import org.sonar.db.DbSession;
import org.sonar.db.audit.AuditPersister;
@@ -154,7 +153,7 @@ public class PurgeDao implements Dao {
return mapper.selectPurgeableAnalyses(componentUuid).stream()
.filter(new NewCodePeriodAnalysisFilter(mapper, componentUuid))
.sorted()
- .collect(Collectors.toList());
+ .toList();
}
public void purgeCeActivities(DbSession session, PurgeProfiler profiler) {
@@ -293,7 +292,7 @@ public class PurgeDao implements Dao {
* </p>
*/
public void deleteNonRootComponentsInView(DbSession dbSession, Collection<ComponentDto> components) {
- Set<ComponentDto> nonRootComponents = components.stream().filter(PurgeDao::isNotRoot).collect(MoreCollectors.toSet());
+ Set<ComponentDto> nonRootComponents = components.stream().filter(PurgeDao::isNotRoot).collect(Collectors.toSet());
if (nonRootComponents.isEmpty()) {
return;
}
@@ -307,9 +306,9 @@ public class PurgeDao implements Dao {
List<String> subviewsOrProjectCopies = nonRootComponents.stream()
.filter(PurgeDao::isSubview)
.map(ComponentDto::uuid)
- .collect(Collectors.toList());
+ .toList();
purgeCommands.deleteByRootAndSubviews(subviewsOrProjectCopies);
- List<String> nonRootComponentUuids = nonRootComponents.stream().map(ComponentDto::uuid).collect(Collectors.toList());
+ List<String> nonRootComponentUuids = nonRootComponents.stream().map(ComponentDto::uuid).toList();
purgeCommands.deleteComponentMeasures(nonRootComponentUuids);
purgeCommands.deleteComponents(nonRootComponentUuids);
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/DBSessionsImplTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/DBSessionsImplTest.java
index a9b730f4644..ade406c4036 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/DBSessionsImplTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/DBSessionsImplTest.java
@@ -39,7 +39,6 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTester;
-import org.sonar.core.util.stream.MoreCollectors;
import static java.lang.Math.abs;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
@@ -103,7 +102,7 @@ public class DBSessionsImplTest {
underTest.enableCaching();
int size = 1 + abs(random.nextInt(10));
- Set<DbSession> dbSessions = IntStream.range(0, size).mapToObj(ignored -> underTest.openSession(false)).collect(MoreCollectors.toSet());
+ Set<DbSession> dbSessions = IntStream.range(0, size).mapToObj(ignored -> underTest.openSession(false)).collect(Collectors.toSet());
assertThat(dbSessions).hasSize(size);
assertThat(getWrappedDbSessions(dbSessions))
.hasSize(1)
@@ -119,7 +118,7 @@ public class DBSessionsImplTest {
underTest.enableCaching();
int size = 1 + abs(random.nextInt(10));
- Set<DbSession> dbSessions = IntStream.range(0, size).mapToObj(ignored -> underTest.openSession(true)).collect(MoreCollectors.toSet());
+ Set<DbSession> dbSessions = IntStream.range(0, size).mapToObj(ignored -> underTest.openSession(true)).collect(Collectors.toSet());
assertThat(dbSessions).hasSize(size);
assertThat(getWrappedDbSessions(dbSessions))
.hasSize(1)
diff --git a/server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java b/server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java
index 5236014a1b4..ed27f1dfa2d 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java
@@ -28,7 +28,6 @@ import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.process.MessageException;
import org.sonar.process.NetworkUtils;
import org.sonar.process.ProcessId;
@@ -204,7 +203,7 @@ public class ClusterSettings implements Consumer<Props> {
private void ensureNotLoopbackAddresses(Property property, Set<AddressAndPort> hostAndPorts) {
Set<AddressAndPort> loopbackAddresses = hostAndPorts.stream()
.filter(t -> network.isLoopback(t.getHost()))
- .collect(MoreCollectors.toSet());
+ .collect(toSet());
if (!loopbackAddresses.isEmpty()) {
throw new MessageException(format("Property %s must not contain a loopback address: %s", property.getKey(),
loopbackAddresses.stream().map(AddressAndPort::getHost).sorted().collect(Collectors.joining(", "))));
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/BuiltIndex.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/BuiltIndex.java
index 3a2bda550b5..af95666fc14 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/BuiltIndex.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/BuiltIndex.java
@@ -26,11 +26,11 @@ import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import java.util.stream.Collectors;
import org.elasticsearch.common.settings.Settings;
import org.sonar.server.es.IndexType;
import org.sonar.server.es.IndexType.IndexRelationType;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.server.es.IndexType.FIELD_INDEX_TYPE;
import static org.sonar.server.es.newindex.DefaultIndexSettings.NORMS;
import static org.sonar.server.es.newindex.DefaultIndexSettings.STORE;
@@ -48,7 +48,7 @@ public final class BuiltIndex<T extends NewIndex<T>> {
BuiltIndex(T newIndex) {
this.mainType = newIndex.getMainType();
this.settings = newIndex.getSettings().build();
- this.relationTypes = newIndex.getRelationsStream().collect(toSet());
+ this.relationTypes = newIndex.getRelationsStream().collect(Collectors.toSet());
this.attributes = buildAttributes(newIndex);
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java
index 61737bb72bf..62d05308fad 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/DefaultNotificationManager.java
@@ -33,7 +33,6 @@ import org.sonar.api.notifications.NotificationChannel;
import org.sonar.api.utils.SonarException;
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.EmailSubscriberDto;
@@ -148,7 +147,7 @@ public class DefaultNotificationManager implements NotificationManager {
return keepAuthorizedEmailSubscribers(dbSession, projectKey, emailSubscribers, subscriberPermissionsOnProject)
.map(emailSubscriber -> new EmailRecipient(emailSubscriber.getLogin(), emailSubscriber.getEmail()))
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
}
private Stream<EmailSubscriberDto> keepAuthorizedEmailSubscribers(DbSession dbSession, String projectKey, Set<EmailSubscriberDto> emailSubscribers,
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 16377c9201b..1aca05b2028 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.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.server.security.SecurityStandards.VulnerabilityProbability.HIGH;
import static org.sonar.server.security.SecurityStandards.VulnerabilityProbability.LOW;
@@ -338,11 +337,11 @@ public final class SecurityStandards {
* @throws IllegalStateException if {@code securityStandards} maps to multiple {@link SQCategory SQCategories}
*/
public static SecurityStandards fromSecurityStandards(Set<String> securityStandards) {
- Set<String> standards = securityStandards.stream().filter(Objects::nonNull).collect(toSet());
+ Set<String> standards = securityStandards.stream().filter(Objects::nonNull).collect(Collectors.toSet());
Set<String> cwe = toCwes(standards);
List<SQCategory> sq = toSortedSQCategories(cwe);
SQCategory sqCategory = sq.iterator().next();
- Set<SQCategory> ignoredSQCategories = sq.stream().skip(1).collect(toSet());
+ Set<SQCategory> ignoredSQCategories = sq.stream().skip(1).collect(Collectors.toSet());
return new SecurityStandards(standards, cwe, sqCategory, ignoredSQCategories);
}
@@ -360,14 +359,14 @@ public final class SecurityStandards {
return securityStandards.stream()
.filter(s -> s.startsWith(prefix))
.map(s -> s.substring(prefix.length()))
- .collect(toSet());
+ .collect(Collectors.toSet());
}
private static Set<String> toCwes(Collection<String> securityStandards) {
Set<String> result = securityStandards.stream()
.filter(s -> s.startsWith(CWE_PREFIX))
.map(s -> s.substring(CWE_PREFIX.length()))
- .collect(toSet());
+ .collect(Collectors.toSet());
return result.isEmpty() ? singleton(UNKNOWN_STANDARD) : result;
}
@@ -376,7 +375,7 @@ public final class SecurityStandards {
.keySet()
.stream()
.filter(k -> cwe.stream().anyMatch(CWES_BY_CWE_TOP_25.get(k)::contains))
- .collect(toSet());
+ .collect(Collectors.toSet());
}
private static Set<String> toSansTop25(Collection<String> cwe) {
@@ -384,7 +383,7 @@ public final class SecurityStandards {
.keySet()
.stream()
.filter(k -> cwe.stream().anyMatch(CWES_BY_SANS_TOP_25.get(k)::contains))
- .collect(toSet());
+ .collect(Collectors.toSet());
}
private static List<SQCategory> toSortedSQCategories(Collection<String> cwe) {
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java
index 5caab5128b8..851927c0590 100644
--- a/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java
+++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/project/ProjectLifeCycleListenersImplTest.java
@@ -25,12 +25,12 @@ import com.tngtech.java.junit.dataprovider.UseDataProvider;
import java.util.Collections;
import java.util.Random;
import java.util.Set;
+import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mockito;
-import org.sonar.core.util.stream.MoreCollectors;
import static java.util.Collections.singleton;
import static org.assertj.core.api.Assertions.assertThat;
@@ -203,7 +203,7 @@ public class ProjectLifeCycleListenersImplTest {
public static Object[][] oneOrManyProjects() {
return new Object[][] {
{singleton(newUniqueProject())},
- {IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> newUniqueProject()).collect(MoreCollectors.toSet())}
+ {IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> newUniqueProject()).collect(Collectors.toSet())}
};
}
@@ -212,7 +212,7 @@ public class ProjectLifeCycleListenersImplTest {
return new Object[][] {
{singleton(newUniqueProject())},
{IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> new DeletedProject(newUniqueProject(), "branch_" + i))
- .collect(MoreCollectors.toSet())}
+ .collect(Collectors.toSet())}
};
}
@@ -294,7 +294,7 @@ public class ProjectLifeCycleListenersImplTest {
public static Object[][] oneOrManyRekeyedProjects() {
return new Object[][] {
{singleton(newUniqueRekeyedProject())},
- {IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> newUniqueRekeyedProject()).collect(MoreCollectors.toSet())}
+ {IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> newUniqueRekeyedProject()).collect(Collectors.toSet())}
};
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
index 23e077a5764..4116d8099f9 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
@@ -77,7 +77,6 @@ import static java.util.Collections.emptyList;
import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableMap;
import static org.apache.commons.lang.StringUtils.isNotEmpty;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
/**
@@ -140,7 +139,7 @@ public class RegisterRules implements Startable {
persistRepositories(dbSession, ruleDefinitionContext.repositories());
// FIXME lack of resiliency, active rules index is corrupted if rule index fails
// to be updated. Only a single DB commit should be executed.
- ruleIndexer.commitAndIndex(dbSession, registerRulesContext.getAllModified().map(RuleDto::getUuid).collect(toSet()));
+ ruleIndexer.commitAndIndex(dbSession, registerRulesContext.getAllModified().map(RuleDto::getUuid).collect(Collectors.toSet()));
changes.forEach(arChange -> dbClient.qProfileChangeDao().insert(dbSession, arChange.toDto(null)));
activeRuleIndexer.commitAndIndex(dbSession, changes);
registerRulesContext.getRenamed().forEach(e -> LOG.info("Rule {} re-keyed to {}", e.getValue(), e.getKey().getKey()));
@@ -812,7 +811,7 @@ public class RegisterRules implements Startable {
return Stream.concat(
context.stream().map(RulesDefinition.ExtendedRepository::key),
recorder.getRenamed().map(Map.Entry::getValue).map(RuleKey::repository))
- .collect(toSet());
+ .collect(Collectors.toSet());
}
private void update(DbSession session, RuleDto rule) {
@@ -827,7 +826,7 @@ public class RegisterRules implements Startable {
Set<RuleKey> definedRuleKeys = definedRules.stream()
.map(r -> RuleKey.of(r.repository().key(), r.key()))
- .collect(toSet());
+ .collect(Collectors.toSet());
List<RuleKey> definedDeprecatedRuleKeys = definedRules.stream()
.flatMap(r -> r.deprecatedRuleKeys().stream())
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java
index 92543babeec..7e34b0123a0 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java
@@ -74,7 +74,6 @@ import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
import static org.sonar.api.web.UserRole.USER;
import static org.sonar.core.util.stream.MoreCollectors.toHashSet;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.db.newcodeperiod.NewCodePeriodType.REFERENCE_BRANCH;
import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS;
@@ -119,7 +118,7 @@ public class IssueQueryFactory {
Collection<RuleDto> ruleDtos = ruleKeysToRuleId(dbSession, request.getRules());
Collection<String> ruleUuids = ruleDtos.stream().map(RuleDto::getUuid).collect(Collectors.toSet());
- if (request.getRules() != null && request.getRules().stream().collect(toSet()).size() != ruleDtos.size()) {
+ if (request.getRules() != null && request.getRules().stream().collect(Collectors.toSet()).size() != ruleDtos.size()) {
ruleUuids.add("non-existing-uuid");
}
@@ -371,7 +370,7 @@ public class IssueQueryFactory {
Set<String> authorizedAppBranchUuids = appBranchComponents.stream()
.filter(app -> userSession.hasComponentPermission(USER, app) && userSession.hasChildProjectsPermission(USER, app))
.map(ComponentDto::uuid)
- .collect(toSet());
+ .collect(Collectors.toSet());
builder.viewUuids(authorizedAppBranchUuids.isEmpty() ? singleton(UNKNOWN) : authorizedAppBranchUuids);
addCreatedAfterByProjects(builder, dbSession, request, authorizedAppBranchUuids);
@@ -384,7 +383,7 @@ public class IssueQueryFactory {
Set<String> projectBranchUuids = appBranchUuids.stream()
.flatMap(app -> dbClient.componentDao().selectProjectBranchUuidsFromView(dbSession, app, app).stream())
- .collect(toSet());
+ .collect(Collectors.toSet());
List<SnapshotDto> snapshots = getLastAnalysis(dbSession, projectBranchUuids);
@@ -392,7 +391,7 @@ public class IssueQueryFactory {
.stream()
.filter(s -> isLastAnalysisFromReAnalyzedReferenceBranch(dbSession, s))
.map(SnapshotDto::getRootComponentUuid)
- .collect(toSet());
+ .collect(Collectors.toSet());
Map<String, PeriodStart> leakByProjects = snapshots
.stream()
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskAction.java
index daf7856c9aa..136076cc959 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskAction.java
@@ -35,7 +35,6 @@ import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.web.UserRole;
import org.sonar.core.util.Uuids;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.ce.CeActivityDto;
@@ -193,7 +192,7 @@ public class TaskAction implements CeWsAction {
return null;
})
.filter(Objects::nonNull)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
}
public static Collection<String> possibleValues() {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
index 9ca8ed057dc..ed00c1fde3c 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
@@ -184,7 +184,7 @@ public class TaskFormatter {
Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
.selectByTaskUuids(dbSession, ceQueueDtos.stream().map(CeQueueDto::getUuid).toList())
.stream().collect(MoreCollectors.index(CeTaskCharacteristicDto::getTaskUuid));
- Set<String> submitterUuids = ceQueueDtos.stream().map(CeQueueDto::getSubmitterUuid).filter(Objects::nonNull).collect(toSet());
+ Set<String> submitterUuids = ceQueueDtos.stream().map(CeQueueDto::getSubmitterUuid).filter(Objects::nonNull).collect(Collectors.toSet());
Map<String, UserDto> usersByUuid = dbClient.userDao().selectByUuids(dbSession, submitterUuids).stream().collect(uniqueIndex(UserDto::getUuid));
return new DtoCache(componentsByUuid, characteristicsByTaskUuid, usersByUuid);
}
@@ -206,7 +206,7 @@ public class TaskFormatter {
Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
.selectByTaskUuids(dbSession, ceActivityDtos.stream().map(CeActivityDto::getUuid).toList())
.stream().collect(MoreCollectors.index(CeTaskCharacteristicDto::getTaskUuid));
- Set<String> submitterUuids = ceActivityDtos.stream().map(CeActivityDto::getSubmitterUuid).filter(Objects::nonNull).collect(toSet());
+ Set<String> submitterUuids = ceActivityDtos.stream().map(CeActivityDto::getSubmitterUuid).filter(Objects::nonNull).collect(Collectors.toSet());
Map<String, UserDto> usersByUuid = dbClient.userDao().selectByUuids(dbSession, submitterUuids).stream().collect(uniqueIndex(UserDto::getUuid));
return new DtoCache(componentsByUuid, characteristicsByTaskUuid, usersByUuid);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java
index 38e22479777..3ea63859a0a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java
@@ -329,7 +329,7 @@ public class SearchProjectsAction implements ComponentsWsAction {
return dbClient.projectDao().selectByUuids(dbSession, favoriteDbUuids).stream()
.map(ProjectDto::getUuid)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
}
private List<SnapshotDto> getSnapshots(DbSession dbSession, SearchProjectsRequest request, Collection<String> mainBranchUuids) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java
index 6065459aa92..eb56570fd3e 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java
@@ -61,7 +61,6 @@ import static java.util.Collections.emptyList;
import static java.util.Collections.emptySet;
import static java.util.Collections.singletonList;
import static org.sonar.api.web.UserRole.USER;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.server.component.index.SuggestionQuery.DEFAULT_LIMIT;
import static org.sonar.server.es.newindex.DefaultIndexSettings.MINIMUM_NGRAM_LENGTH;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
@@ -225,7 +224,7 @@ public class SuggestionsAction implements ComponentsWsAction {
.map(ComponentHitsPerQualifier::getHits)
.flatMap(Collection::stream)
.map(ComponentHit::getUuid)
- .collect(toSet());
+ .collect(Collectors.toSet());
List<EntityDto> entities = dbClient.entityDao().selectByUuids(dbSession, entityUuids);
Set<String> favoriteUuids = favorites.stream().map(EntityDto::getUuid).collect(MoreCollectors.toSet(favorites.size()));
SuggestionsWsResponse.Builder searchWsResponse = buildResponse(recentlyBrowsedKeys, favoriteUuids, componentsPerQualifiers, entities, skip + limit);
@@ -248,7 +247,7 @@ public class SuggestionsAction implements ComponentsWsAction {
private List<String> getQualifiers(@Nullable String more) {
Set<String> availableQualifiers = resourceTypes.getAll().stream()
.map(ResourceType::getQualifier)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
if (more == null) {
return stream(SuggestionCategory.values())
.map(SuggestionCategory::getQualifier)
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/AppNodeClusterCheck.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/AppNodeClusterCheck.java
index da485b6dc19..565dbc868fb 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/AppNodeClusterCheck.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/health/AppNodeClusterCheck.java
@@ -21,10 +21,10 @@ package org.sonar.server.health;
import java.util.Arrays;
import java.util.Set;
+import java.util.stream.Collectors;
import org.sonar.process.cluster.health.NodeDetails;
import org.sonar.process.cluster.health.NodeHealth;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.process.cluster.health.NodeHealth.Status.GREEN;
import static org.sonar.process.cluster.health.NodeHealth.Status.RED;
import static org.sonar.process.cluster.health.NodeHealth.Status.YELLOW;
@@ -35,7 +35,7 @@ public class AppNodeClusterCheck implements ClusterHealthCheck {
public Health check(Set<NodeHealth> nodeHealths) {
Set<NodeHealth> appNodes = nodeHealths.stream()
.filter(s -> s.getDetails().getType() == NodeDetails.Type.APPLICATION)
- .collect(toSet());
+ .collect(Collectors.toSet());
return Arrays.stream(AppNodeClusterHealthSubChecks.values())
.map(s -> s.check(appNodes))
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java
index ea0a818f06f..4b98e574ed5 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java
@@ -87,7 +87,6 @@ import static org.sonar.api.utils.DateUtils.formatDateTime;
import static org.sonar.api.utils.DateUtils.longToDate;
import static org.sonar.api.utils.Paging.forPageIndex;
import static org.sonar.api.web.UserRole.USER;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.db.newcodeperiod.NewCodePeriodType.REFERENCE_BRANCH;
import static org.sonar.server.security.SecurityStandards.SANS_TOP_25_INSECURE_INTERACTION;
@@ -504,7 +503,7 @@ public class SearchAction implements HotspotsWsAction {
.stream()
.filter(s -> !isNullOrEmpty(s.getPeriodMode()) && s.getPeriodMode().equals(REFERENCE_BRANCH.name()))
.map(SnapshotDto::getRootComponentUuid)
- .collect(toSet());
+ .collect(Collectors.toSet());
Map<String, IssueQuery.PeriodStart> leakByProjects = snapshots
.stream()
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java
index 634143f37c8..02150ba6033 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ShowAction.java
@@ -25,6 +25,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@@ -76,7 +77,6 @@ import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSe
import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.HOW_TO_FIX_SECTION_KEY;
import static org.sonar.api.server.rule.RuleDescriptionSection.RuleDescriptionSectionKeys.ROOT_CAUSE_SECTION_KEY;
import static org.sonar.api.utils.DateUtils.formatDateTime;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.db.rule.RuleDescriptionSectionDto.DEFAULT_KEY;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
@@ -266,7 +266,7 @@ public class ShowAction implements HotspotsWsAction {
Set<UserDto> preloadedUsers = Stream.of(users.getAssignee(), users.getAuthor())
.filter(Optional::isPresent)
.map(Optional::get)
- .collect(toSet());
+ .collect(Collectors.toSet());
FormattingContext formattingContext = issueChangeSupport
.newFormattingContext(dbSession, singleton(hotspot), Load.ALL, preloadedUsers, Set.of(components.component));
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssueChangeWSSupport.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssueChangeWSSupport.java
index a2182e03d35..41eb4e4786e 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssueChangeWSSupport.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssueChangeWSSupport.java
@@ -55,7 +55,6 @@ import static java.util.Collections.emptyMap;
import static java.util.Optional.empty;
import static java.util.Optional.ofNullable;
import static org.sonar.api.utils.DateUtils.formatDateTime;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.db.issue.IssueChangeDto.TYPE_COMMENT;
import static org.sonar.db.issue.IssueChangeDto.TYPE_FIELD_CHANGE;
@@ -99,7 +98,7 @@ public class IssueChangeWSSupport {
}
public FormattingContext newFormattingContext(DbSession dbSession, Set<IssueDto> dtos, Load load, Set<UserDto> preloadedUsers, Set<ComponentDto> preloadedComponents) {
- Set<String> issueKeys = dtos.stream().map(IssueDto::getKey).collect(toSet());
+ Set<String> issueKeys = dtos.stream().map(IssueDto::getKey).collect(Collectors.toSet());
List<IssueChangeDto> changes = List.of();
List<IssueChangeDto> comments = List.of();
@@ -156,7 +155,7 @@ public class IssueChangeWSSupport {
.map(IssueChangeDto::getUserUuid)
)
.filter(Objects::nonNull)
- .collect(toSet());
+ .collect(Collectors.toSet());
if (userUuids.isEmpty()) {
return emptyMap();
}
@@ -188,7 +187,7 @@ public class IssueChangeWSSupport {
})
.map(Strings::emptyToNull)
.filter(Objects::nonNull)
- .collect(toSet());
+ .collect(Collectors.toSet());
if (fileUuids.isEmpty()) {
return emptyMap();
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TransitionAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TransitionAction.java
index 940952f7512..5f501f904d7 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TransitionAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TransitionAction.java
@@ -21,9 +21,9 @@ package org.sonar.server.issue;
import java.util.Collection;
import java.util.Map;
+import java.util.stream.Collectors;
import org.sonar.api.server.ServerSide;
import org.sonar.core.issue.DefaultIssue;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.server.issue.workflow.Transition;
import org.sonar.server.user.UserSession;
@@ -65,7 +65,7 @@ public class TransitionAction extends Action {
return transitionService.listTransitions(issue)
.stream()
.map(Transition::key)
- .collect(MoreCollectors.toSet())
+ .collect(Collectors.toSet())
.contains(transitionKey);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
index d51fba13081..0aa9dd6be99 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
@@ -47,7 +47,6 @@ import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
import org.sonar.core.issue.DefaultIssue;
import org.sonar.core.issue.IssueChangeContext;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.BranchDto;
@@ -386,16 +385,16 @@ public class BulkChangeAction implements IssuesWsAction {
.filter(issueDto -> SECURITY_HOTSPOT.getDbConstant() != issueDto.getType())
.toList();
- List<ComponentDto> allBranches = getComponents(dbSession, allIssues.stream().map(IssueDto::getProjectUuid).collect(MoreCollectors.toSet()));
+ List<ComponentDto> allBranches = getComponents(dbSession, allIssues.stream().map(IssueDto::getProjectUuid).collect(Collectors.toSet()));
this.branchComponentByUuid = getAuthorizedComponents(allBranches).stream().collect(uniqueIndex(ComponentDto::uuid, identity()));
this.branchesByProjectUuid = dbClient.branchDao().selectByUuids(dbSession, branchComponentByUuid.keySet()).stream()
.collect(uniqueIndex(BranchDto::getUuid, identity()));
this.issues = getAuthorizedIssues(allIssues);
this.componentsByUuid = getComponents(dbSession,
- issues.stream().map(DefaultIssue::componentUuid).collect(MoreCollectors.toSet())).stream()
+ issues.stream().map(DefaultIssue::componentUuid).collect(Collectors.toSet())).stream()
.collect(uniqueIndex(ComponentDto::uuid, identity()));
this.rulesByKey = dbClient.ruleDao().selectByKeys(dbSession,
- issues.stream().map(DefaultIssue::ruleKey).collect(MoreCollectors.toSet())).stream()
+ issues.stream().map(DefaultIssue::ruleKey).collect(Collectors.toSet())).stream()
.collect(uniqueIndex(RuleDto::getKey, identity()));
this.availableActions = actions.stream()
@@ -413,7 +412,7 @@ public class BulkChangeAction implements IssuesWsAction {
}
private List<DefaultIssue> getAuthorizedIssues(List<IssueDto> allIssues) {
- Set<String> branchUuids = branchComponentByUuid.values().stream().map(ComponentDto::uuid).collect(MoreCollectors.toSet());
+ Set<String> branchUuids = branchComponentByUuid.values().stream().map(ComponentDto::uuid).collect(Collectors.toSet());
return allIssues.stream()
.filter(issue -> branchUuids.contains(issue.getProjectUuid()))
.map(IssueDto::toDefaultIssue)
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
index 432f747a383..615defa5a20 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
@@ -74,7 +74,6 @@ import static org.sonar.api.issue.Issue.STATUS_REVIEWED;
import static org.sonar.api.issue.Issue.STATUS_TO_REVIEW;
import static org.sonar.api.server.ws.WebService.Param.FACETS;
import static org.sonar.api.utils.Paging.forPageIndex;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.server.es.SearchOptions.MAX_PAGE_SIZE;
import static org.sonar.server.issue.index.IssueIndex.FACET_ASSIGNED_TO_ME;
import static org.sonar.server.issue.index.IssueIndex.FACET_PROJECTS;
@@ -426,7 +425,7 @@ public class SearchAction implements IssuesWsAction {
Set<String> facetsRequiringProjectParameter = options.getFacets().stream()
.filter(FACETS_REQUIRING_PROJECT::contains)
- .collect(toSet());
+ .collect(Collectors.toSet());
checkArgument(facetsRequiringProjectParameter.isEmpty() ||
(!query.projectUuids().isEmpty()), "Facet(s) '%s' require to also filter by project",
String.join(",", facetsRequiringProjectParameter));
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
index d21066a5edc..288929d9879 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
@@ -173,7 +173,7 @@ public class SearchResponseLoader {
for (ComponentDto component : loadedComponents) {
collector.addBranchUuid(component.branchUuid());
}
- Set<String> loadedBranchUuids = loadedComponents.stream().filter(cpt -> cpt.uuid().equals(cpt.branchUuid())).map(ComponentDto::uuid).collect(MoreCollectors.toSet());
+ Set<String> loadedBranchUuids = loadedComponents.stream().filter(cpt -> cpt.uuid().equals(cpt.branchUuid())).map(ComponentDto::uuid).collect(Collectors.toSet());
Set<String> branchUuidsToLoad = copyOf(difference(collector.getBranchUuids(), loadedBranchUuids));
if (!branchUuidsToLoad.isEmpty()) {
List<ComponentDto> branchComponents = dbClient.componentDao().selectByUuids(dbSession, collector.getBranchUuids());
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java
index efbdf73f508..8ddcebeb000 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java
@@ -138,7 +138,7 @@ public class SearchAction implements MeasuresWsAction {
private List<ComponentDto> searchProjects() {
List<ComponentDto> componentDtos = searchByProjectKeys(dbSession, request.getProjectKeys());
- checkArgument(ALLOWED_QUALIFIERS.containsAll(componentDtos.stream().map(ComponentDto::qualifier).collect(MoreCollectors.toSet())),
+ checkArgument(ALLOWED_QUALIFIERS.containsAll(componentDtos.stream().map(ComponentDto::qualifier).collect(Collectors.toSet())),
"Only component of qualifiers %s are allowed", ALLOWED_QUALIFIERS);
return getAuthorizedProjects(componentDtos);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java
index da2c8846683..22fa5116229 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java
@@ -206,8 +206,8 @@ public class SearchHistoryAction implements MeasuresWsAction {
private List<MetricDto> searchMetrics(DbSession dbSession, SearchHistoryRequest request) {
List<MetricDto> metrics = dbClient.metricDao().selectByKeys(dbSession, request.getMetrics());
if (request.getMetrics().size() > metrics.size()) {
- Set<String> requestedMetrics = request.getMetrics().stream().collect(MoreCollectors.toSet());
- Set<String> foundMetrics = metrics.stream().map(MetricDto::getKey).collect(MoreCollectors.toSet());
+ Set<String> requestedMetrics = request.getMetrics().stream().collect(Collectors.toSet());
+ Set<String> foundMetrics = metrics.stream().map(MetricDto::getKey).collect(Collectors.toSet());
Set<String> unfoundMetrics = Sets.difference(requestedMetrics, foundMetrics).immutableCopy();
throw new IllegalArgumentException(format("Metrics %s are not found", String.join(", ", unfoundMetrics)));
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ValidRatingMetrics.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ValidRatingMetrics.java
index c5a6e8ddf72..e7e24667553 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ValidRatingMetrics.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ValidRatingMetrics.java
@@ -20,17 +20,17 @@
package org.sonar.server.qualitygate;
import java.util.Set;
+import java.util.stream.Collectors;
import org.sonar.api.measures.CoreMetrics;
import static org.sonar.api.measures.Metric.ValueType.RATING;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
public class ValidRatingMetrics {
private static final Set<String> CORE_RATING_METRICS = CoreMetrics.getMetrics().stream()
.filter(metric -> metric.getType().equals(RATING))
.map(org.sonar.api.measures.Metric::getKey)
- .collect(toSet());
+ .collect(Collectors.toSet());
private ValidRatingMetrics() {
// only static methods
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java
index fa71652ad4b..a11d09c4625 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java
@@ -41,7 +41,6 @@ import org.sonarqube.ws.Qualitygates.ShowWsResponse;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Optional.ofNullable;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
@@ -103,7 +102,7 @@ public class ShowAction implements QualityGatesWsAction {
}
private Map<String, MetricDto> getMetricsByUuid(DbSession dbSession, Collection<QualityGateConditionDto> conditions) {
- Set<String> metricUuids = conditions.stream().map(QualityGateConditionDto::getMetricUuid).collect(toSet());
+ Set<String> metricUuids = conditions.stream().map(QualityGateConditionDto::getMetricUuid).collect(Collectors.toSet());
return dbClient.metricDao().selectByUuids(dbSession, metricUuids).stream().filter(MetricDto::isEnabled).collect(uniqueIndex(MetricDto::getUuid));
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandler.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandler.java
index 016fd42cb04..b8556424b9a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandler.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQPChangeNotificationHandler.java
@@ -22,6 +22,7 @@ package org.sonar.server.qualityprofile.builtin;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
+import java.util.stream.Collectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.server.notification.EmailNotificationHandler;
@@ -29,8 +30,6 @@ import org.sonar.server.notification.NotificationDispatcherMetadata;
import org.sonar.server.notification.email.EmailNotificationChannel;
import org.sonar.server.notification.email.EmailNotificationChannel.EmailDeliveryRequest;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
-
public class BuiltInQPChangeNotificationHandler extends EmailNotificationHandler<BuiltInQPChangeNotification> {
private final DbClient dbClient;
@@ -56,7 +55,7 @@ public class BuiltInQPChangeNotificationHandler extends EmailNotificationHandler
.selectQualityProfileAdministratorLogins(session)
.stream()
.flatMap(t -> notifications.stream().map(notification -> new EmailDeliveryRequest(t.getEmail(), notification)))
- .collect(toSet());
+ .collect(Collectors.toSet());
}
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileRepositoryImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileRepositoryImpl.java
index 95b58d1fa9e..f1a9974dab4 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileRepositoryImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileRepositoryImpl.java
@@ -191,7 +191,7 @@ public class BuiltInQProfileRepositoryImpl implements BuiltInQProfileRepository
Set<String> declaredDefaultProfileNames = entry.getValue().stream()
.filter(BuiltInQProfile.Builder::isDeclaredDefault)
.map(BuiltInQProfile.Builder::getName)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
checkState(declaredDefaultProfileNames.size() <= 1, "Several Quality profiles are flagged as default for the language %s: %s", entry.getKey(), declaredDefaultProfileNames);
return true;
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileUpdateImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileUpdateImpl.java
index b5292bcb4e6..7573cdbf284 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileUpdateImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileUpdateImpl.java
@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition;
import org.sonar.core.util.stream.MoreCollectors;
@@ -36,8 +37,6 @@ import org.sonar.server.qualityprofile.ActiveRuleChange;
import org.sonar.server.qualityprofile.RuleActivation;
import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
-
public class BuiltInQProfileUpdateImpl implements BuiltInQProfileUpdate {
private final DbClient dbClient;
@@ -64,7 +63,7 @@ public class BuiltInQProfileUpdateImpl implements BuiltInQProfileUpdate {
Set<String> ruleUuids = Stream.concat(
deactivatedRuleUuids.stream(),
builtInDefinition.getActiveRules().stream().map(BuiltInQProfile.ActiveRule::getRuleUuid))
- .collect(toSet());
+ .collect(Collectors.toSet());
Collection<RuleActivation> activations = new ArrayList<>();
for (BuiltInQProfile.ActiveRule ar : builtInDefinition.getActiveRules()) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddGroupAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddGroupAction.java
index 39b6f0362cd..3c59e262f01 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddGroupAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddGroupAction.java
@@ -20,6 +20,7 @@
package org.sonar.server.qualityprofile.ws;
import java.util.Arrays;
+import java.util.stream.Collectors;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
@@ -32,7 +33,6 @@ import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.qualityprofile.QProfileEditGroupsDto;
import org.sonar.db.user.GroupDto;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_ADD_GROUP;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_GROUP;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
@@ -76,7 +76,7 @@ public class AddGroupAction implements QProfileWsAction {
.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
action.createParam(PARAM_GROUP)
.setDescription("Group name")
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddUserAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddUserAction.java
index ddd82473395..78636fef2db 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddUserAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/AddUserAction.java
@@ -20,6 +20,7 @@
package org.sonar.server.qualityprofile.ws;
import java.util.Arrays;
+import java.util.stream.Collectors;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
@@ -32,7 +33,6 @@ import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.qualityprofile.QProfileEditUsersDto;
import org.sonar.db.user.UserDto;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_ADD_USER;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LOGIN;
@@ -76,7 +76,7 @@ public class AddUserAction implements QProfileWsAction {
.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
action.createParam(PARAM_LOGIN)
.setDescription("User login")
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java
index 0b213ad8a9d..7ec0284e334 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java
@@ -46,7 +46,6 @@ import org.sonar.db.user.UserDto;
import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.server.es.SearchOptions.MAX_PAGE_SIZE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_SINCE;
@@ -123,7 +122,7 @@ public class ChangelogAction implements QProfileWsAction {
Set<String> userUuids = changes.stream()
.map(Change::getUserUuid)
.filter(Objects::nonNull)
- .collect(toSet());
+ .collect(Collectors.toSet());
return dbClient.userDao()
.selectByUuids(dbSession, userUuids)
.stream()
@@ -134,7 +133,7 @@ public class ChangelogAction implements QProfileWsAction {
Set<String> ruleUuids = changes.stream()
.map(c -> c.ruleUuid)
.filter(Objects::nonNull)
- .collect(toSet());
+ .collect(Collectors.toSet());
return dbClient.ruleDao()
.selectByUuids(dbSession, Lists.newArrayList(ruleUuids))
.stream()
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ExportAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ExportAction.java
index a9fdab49466..72fcda8fbd4 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ExportAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ExportAction.java
@@ -27,6 +27,7 @@ import java.io.Writer;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
+import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.apache.commons.io.IOUtils;
import org.sonar.api.profiles.ProfileExporter;
@@ -36,7 +37,6 @@ import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.Response.Stream;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.NewAction;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.qualityprofile.QProfileDto;
@@ -88,7 +88,7 @@ public class ExportAction implements QProfileWsAction {
.map(language -> exporters.exportersForLanguage(language.getKey()))
.flatMap(Collection::stream)
.map(ProfileExporter::getKey)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
if (!exporterKeys.isEmpty()) {
action.createParam(PARAM_EXPORTER_KEY)
.setDescription("Output format. If left empty, the same format as api/qualityprofiles/backup is used. " +
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java
index 16ccfa2eca3..25972382200 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java
@@ -33,7 +33,6 @@ import org.sonar.api.server.ws.WebService.SelectionMode;
import org.sonar.api.utils.Paging;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.api.web.UserRole;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.qualityprofile.ProjectQprofileAssociationDto;
@@ -106,7 +105,7 @@ public class ProjectsAction implements QProfileWsAction {
Collection<String> projectUuids = projects.stream()
.map(ProjectQprofileAssociationDto::getProjectUuid)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
Set<String> authorizedProjectUuids = dbClient.authorizationDao().keepAuthorizedEntityUuids(session, projectUuids, userSession.getUuid(), UserRole.USER);
Paging paging = forPageIndex(page).withPageSize(pageSize).andTotal(authorizedProjectUuids.size());
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java
index cbc54a95575..b4b9f1b30a0 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java
@@ -21,12 +21,12 @@ package org.sonar.server.qualityprofile.ws;
import java.util.Arrays;
import java.util.Objects;
+import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.WebService;
-import org.sonar.core.util.stream.MoreCollectors;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Objects.requireNonNull;
@@ -141,6 +141,6 @@ public class QProfileReference {
action.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language.")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(MoreCollectors.toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveGroupAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveGroupAction.java
index 9d92a11621a..39590a239a3 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveGroupAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveGroupAction.java
@@ -20,6 +20,7 @@
package org.sonar.server.qualityprofile.ws;
import java.util.Arrays;
+import java.util.stream.Collectors;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
@@ -30,7 +31,6 @@ import org.sonar.db.DbSession;
import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.user.GroupDto;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_REMOVE_GROUP;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_GROUP;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
@@ -72,7 +72,7 @@ public class RemoveGroupAction implements QProfileWsAction {
.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
action.createParam(PARAM_GROUP)
.setDescription("Group name")
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveUserAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveUserAction.java
index c393c8724eb..460448a46bf 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveUserAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/RemoveUserAction.java
@@ -20,6 +20,7 @@
package org.sonar.server.qualityprofile.ws;
import java.util.Arrays;
+import java.util.stream.Collectors;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
@@ -30,7 +31,6 @@ import org.sonar.db.DbSession;
import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.user.UserDto;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_REMOVE_USER;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LOGIN;
@@ -72,7 +72,7 @@ public class RemoveUserAction implements QProfileWsAction {
.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
action.createParam(PARAM_LOGIN)
.setDescription("User login")
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
index 26269cabc6e..bc2bd5c88ff 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
@@ -226,7 +226,7 @@ public class SearchAction implements QProfileWsAction {
}
private Set<String> getLanguageKeys() {
- return Arrays.stream(languages.all()).map(Language::getKey).collect(MoreCollectors.toSet());
+ return Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet());
}
private SearchWsResponse buildResponse(SearchData data) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchData.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchData.java
index 13ec1409dd2..2cf1534323a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchData.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchData.java
@@ -23,7 +23,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.sonar.core.util.stream.MoreCollectors;
+import java.util.stream.Collectors;
import org.sonar.db.qualityprofile.QProfileDto;
import static com.google.common.base.MoreObjects.firstNonNull;
@@ -79,7 +79,7 @@ class SearchData {
}
SearchData setDefaultProfileKeys(List<QProfileDto> s) {
- this.defaultProfileKeys = s.stream().map(QProfileDto::getKee).collect(MoreCollectors.toSet());
+ this.defaultProfileKeys = s.stream().map(QProfileDto::getKee).collect(Collectors.toSet());
return this;
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java
index 10e5f3f33c8..380d767e653 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchGroupsAction.java
@@ -46,7 +46,6 @@ import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
import static org.sonar.api.server.ws.WebService.SelectionMode.ALL;
import static org.sonar.api.server.ws.WebService.SelectionMode.DESELECTED;
import static org.sonar.api.server.ws.WebService.SelectionMode.fromParam;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.db.Pagination.forPage;
import static org.sonar.db.qualityprofile.SearchQualityProfilePermissionQuery.ANY;
import static org.sonar.db.qualityprofile.SearchQualityProfilePermissionQuery.IN;
@@ -98,7 +97,7 @@ public class SearchGroupsAction implements QProfileWsAction {
.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
}
@Override
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java
index 31460d37fc2..f20eaa876b6 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchUsersAction.java
@@ -49,7 +49,6 @@ import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
import static org.sonar.api.server.ws.WebService.SelectionMode.ALL;
import static org.sonar.api.server.ws.WebService.SelectionMode.DESELECTED;
import static org.sonar.api.server.ws.WebService.SelectionMode.fromParam;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.db.Pagination.forPage;
import static org.sonar.db.qualityprofile.SearchQualityProfilePermissionQuery.ANY;
@@ -104,7 +103,7 @@ public class SearchUsersAction implements QProfileWsAction {
.createParam(PARAM_LANGUAGE)
.setDescription("Quality profile language")
.setRequired(true)
- .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(toSet()));
+ .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(Collectors.toSet()));
}
@Override
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java
index f033da0d217..0aa417e98e5 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.stream.Collectors;
import org.sonar.api.rule.RuleStatus;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
@@ -44,7 +45,6 @@ import static org.sonar.api.server.ws.WebService.Param.SORT;
import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.db.permission.GlobalPermission.ADMINISTER_QUALITY_PROFILES;
import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_ACTIVATION;
@@ -87,7 +87,7 @@ public class RuleWsSupport {
}
Map<String, UserDto> getUsersByUuid(DbSession dbSession, List<RuleDto> rules) {
- Set<String> userUuids = rules.stream().map(RuleDto::getNoteUserUuid).filter(Objects::nonNull).collect(toSet());
+ Set<String> userUuids = rules.stream().map(RuleDto::getNoteUserUuid).filter(Objects::nonNull).collect(Collectors.toSet());
return dbClient.userDao().selectByUuids(dbSession, userUuids).stream().collect(uniqueIndex(UserDto::getUuid));
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java
index 905d3e94c90..6be99ed6105 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ResetAction.java
@@ -22,6 +22,7 @@ package org.sonar.server.setting.ws;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.config.PropertyDefinition;
@@ -31,7 +32,6 @@ import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.web.UserRole;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.entity.EntityDto;
@@ -120,7 +120,7 @@ public class ResetAction implements SettingsWsAction {
PropertyDefinition definition = definitions.get(key);
return definition != null ? definition.key() : key;
})
- .collect(MoreCollectors.toSet()));
+ .collect(Collectors.toSet()));
}
private static ResetRequest toWsRequest(Request request) {
diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebServiceFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebServiceFilter.java
index 4ab60d22d29..1fafd480c36 100644
--- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebServiceFilter.java
+++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/WebServiceFilter.java
@@ -22,6 +22,7 @@ package org.sonar.server.platform.web;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Function;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.sonar.api.server.http.HttpRequest;
import org.sonar.api.server.http.HttpResponse;
@@ -29,7 +30,6 @@ import org.sonar.api.server.ws.WebService;
import org.sonar.api.web.FilterChain;
import org.sonar.api.web.HttpFilter;
import org.sonar.api.web.UrlPattern;
-import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.server.ws.ServletFilterHandler;
import org.sonar.server.ws.ServletRequest;
import org.sonar.server.ws.ServletResponse;
@@ -60,7 +60,7 @@ public class WebServiceFilter extends HttpFilter {
webServiceEngine.controllers().stream()
.flatMap(controller -> controller.actions().stream())
.map(toPath()))
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
this.excludeUrls = concat(MOVED_WEB_SERVICES.stream(),
webServiceEngine.controllers().stream()
.flatMap(controller -> controller.actions().stream())
diff --git a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java
index 4ff57667607..da850aaadc6 100644
--- a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java
+++ b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java
@@ -25,7 +25,6 @@ import java.util.stream.Collectors;
import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.core.util.stream.MoreCollectors;
import static com.google.common.base.Preconditions.checkState;
@@ -65,7 +64,7 @@ public class CoreExtensionsLoader {
Set<String> duplicatedNames = nameCounts.entrySet().stream()
.filter(t -> t.getValue() > 1)
.map(Map.Entry::getKey)
- .collect(MoreCollectors.toSet());
+ .collect(Collectors.toSet());
checkState(duplicatedNames.isEmpty(),
"Multiple core extensions declare the following names: %s",
duplicatedNames.stream().sorted().collect(Collectors.joining(", ")));
diff --git a/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java b/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
index 99eaff761d7..f63a6acf3fd 100644
--- a/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
+++ b/sonar-core/src/main/java/org/sonar/core/metric/ScannerMetrics.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.concurrent.Immutable;
import org.sonar.api.ce.ComputeEngineSide;
@@ -54,7 +55,6 @@ import static org.sonar.api.measures.CoreMetrics.TESTS;
import static org.sonar.api.measures.CoreMetrics.TEST_ERRORS;
import static org.sonar.api.measures.CoreMetrics.TEST_EXECUTION_TIME;
import static org.sonar.api.measures.CoreMetrics.TEST_FAILURES;
-import static org.sonar.core.util.stream.MoreCollectors.toSet;
/**
* This class is used to know the list of metrics that can be sent in the analysis report.
@@ -104,7 +104,7 @@ public class ScannerMetrics {
@Autowired(required = false)
public ScannerMetrics(Metrics[] metricsRepositories) {
- this.metrics = Stream.concat(getPluginMetrics(metricsRepositories), ALLOWED_CORE_METRICS.stream()).collect(toSet());
+ this.metrics = Stream.concat(getPluginMetrics(metricsRepositories), ALLOWED_CORE_METRICS.stream()).collect(Collectors.toSet());
}
/**
diff --git a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java b/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
index ed82847db26..20da1fab62a 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
@@ -56,16 +56,12 @@ public final class MoreCollectors {
return ImmutableList.toImmutableList();
}
- public static <T> Collector<T, ?, Set<T>> toSet() {
- return Collectors.toSet();
- }
-
public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet() {
return ImmutableSet.toImmutableSet();
}
public static <T> Collector<T, ?, Set<T>> toSet(int expectedSize) {
- return toSet();
+ return Collectors.toSet();
}
/**
diff --git a/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java b/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
index 55d104a48af..8ecb9999549 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
@@ -94,11 +94,6 @@ public class MoreCollectorsTest {
}
@Test
- public void toSet_parallel_stream() {
- assertThat(HUGE_SET.parallelStream().collect(toSet())).isEqualTo(HUGE_SET);
- }
-
- @Test
public void toSet_with_size_builds_an_ImmutableSet() {
Set<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toImmutableSet());
assertThat(res).isInstanceOf(ImmutableSet.class)