aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-01-10 15:16:50 +0100
committersonartech <sonartech@sonarsource.com>2023-01-10 20:03:01 +0000
commit54b60b1adac5b703398163ee5edf5a621efc0d24 (patch)
tree2c4595fea6ddefca2b5f33cc9c26000ffb5750ce
parent295a87208f8c9898fbdc733a438587dc03a16877 (diff)
downloadsonarqube-54b60b1adac5b703398163ee5edf5a621efc0d24.tar.gz
sonarqube-54b60b1adac5b703398163ee5edf5a621efc0d24.zip
[NO-JIRA] Remove reported code smells about usages of toList
-rw-r--r--server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java9
-rw-r--r--server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlStatusChecker.java5
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryWithMigration.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java10
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java5
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitor.java5
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java7
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/QualityGateDetailsData.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java7
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStep.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadMeasureComputersStep.java6
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistEventsStep.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepoEntry.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java4
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java5
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java3
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java3
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java3
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java6
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java9
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java4
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java4
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/webhook/WebhookDeliveryTesting.java3
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java3
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/AddPrimaryKeyBuilder.java3
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java2
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java3
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/MigratePortfoliosToNewTables.java3
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java7
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java5
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java3
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java2
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java2
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/es/ProjectIndexers.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/es/searchrequest/RequestFiltersComputer.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java5
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java5
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/metric/MetricFinder.java5
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProvider.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/QPMeasureData.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java8
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/webhook/NetworkInterfaceProvider.java3
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java9
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java21
-rw-r--r--server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java5
-rw-r--r--server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java9
-rw-r--r--server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java2
-rw-r--r--server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java4
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/IdentityProviderRepository.java3
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java6
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java3
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalInfoLoader.java5
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/CommonRuleDefinitionsImpl.java3
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/component/index/ComponentIndexResults.java2
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java2
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java4
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java2
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexSearchTest.java3
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java3
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java6
-rw-r--r--server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/PermissionIndexerTester.java5
-rw-r--r--server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java4
-rw-r--r--server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/qualityprofile/QualityProfileChangeEventServiceImpl.java8
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ListAzureProjectsAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketcloud/SearchBitbucketCloudReposAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/ListBitbucketServerProjectsAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/SearchBitbucketServerReposAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/gitlab/SearchGitlabReposAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListDefinitionsAction.java10
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java6
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/pull/PullActionIssuesRetriever.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/ComponentIndexImpl.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureTreeUpdaterImpl.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/PrMeasureFix.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/UsersAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PendingAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdatesAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/ProjectFinder.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileTreeImpl.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileInsertImpl.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivationContext.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivator.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java5
-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/rule/RuleCreator.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/CreateAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SetAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SettingValidations.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ValuesAction.java10
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/WebAnalyticsLoaderImpl.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/ComponentAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/HomepageTypesImpl.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateIdentityProviderAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/NetworkInterfaceProvider.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/almintegration/ws/bitbucketserver/ImportBitbucketServerProjectActionTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java8
-rw-r--r--server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/MessageFormattingUtils.java3
146 files changed, 238 insertions, 326 deletions
diff --git a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java
index 5eca820bb23..3ac26c2d00b 100644
--- a/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java
+++ b/server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java
@@ -20,7 +20,6 @@
package org.sonar.alm.client.github;
import com.google.gson.Gson;
-
import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
@@ -32,7 +31,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-
import org.sonar.alm.client.github.GithubApplicationHttpClient.GetResponse;
import org.sonar.alm.client.github.GithubBinding.GsonGithubRepository;
import org.sonar.alm.client.github.GithubBinding.GsonInstallations;
@@ -52,7 +50,6 @@ import static java.lang.String.format;
import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
-import static java.util.stream.Collectors.toList;
public class GithubApplicationClientImpl implements GithubApplicationClient {
private static final Logger LOG = Loggers.get(GithubApplicationClientImpl.class);
@@ -121,7 +118,7 @@ public class GithubApplicationClientImpl implements GithubApplicationClient {
List<String> missingPermissions = permissions.entrySet().stream()
.filter(permission -> !Objects.equals(permission.getValue(), perms.get(permission.getKey())))
.map(Map.Entry::getKey)
- .collect(toList());
+ .toList();
if (!missingPermissions.isEmpty()) {
String message = missingPermissions.stream()
@@ -155,7 +152,7 @@ public class GithubApplicationClientImpl implements GithubApplicationClient {
organizations.setOrganizations(gsonInstallations.get().installations.stream()
.map(gsonInstallation -> new Organization(gsonInstallation.account.id, gsonInstallation.account.login, null, null, null, null, null,
gsonInstallation.targetType))
- .collect(toList()));
+ .toList());
}
return organizations;
@@ -184,7 +181,7 @@ public class GithubApplicationClientImpl implements GithubApplicationClient {
if (gsonRepositories.get().items != null) {
repositories.setRepositories(gsonRepositories.get().items.stream()
.map(GsonGithubRepository::toRepository)
- .collect(toList()));
+ .toList());
}
return repositories;
diff --git a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlStatusChecker.java b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlStatusChecker.java
index cf9ce133f80..4ed1f7967da 100644
--- a/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlStatusChecker.java
+++ b/server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlStatusChecker.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import java.util.stream.Collectors;
import static org.sonar.auth.saml.SamlSettings.GROUP_NAME_ATTRIBUTE;
import static org.sonar.auth.saml.SamlSettings.USER_EMAIL_ATTRIBUTE;
@@ -50,7 +49,7 @@ public final class SamlStatusChecker {
samlAuthenticationStatus.getErrors().add(e.getMessage());
}
- samlAuthenticationStatus.getErrors().addAll(auth.getErrors().stream().filter(Objects::nonNull).collect(Collectors.toList()));
+ samlAuthenticationStatus.getErrors().addAll(auth.getErrors().stream().filter(Objects::nonNull).toList());
if (auth.getLastErrorReason() != null) {
samlAuthenticationStatus.getErrors().add(auth.getLastErrorReason());
}
@@ -122,7 +121,7 @@ public final class SamlStatusChecker {
.stream()
.filter(entry -> !entry.getValue().isEmpty() && (auth.getAttribute(entry.getValue()) == null || auth.getAttribute(entry.getValue()).isEmpty()))
.map(entry -> String.format("Mapping not found for the property %s, the field %s is not available in the SAML response.", entry.getKey(), entry.getValue()))
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryWithMigration.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryWithMigration.java
index e345bbda425..78301ff62c5 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryWithMigration.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryWithMigration.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
@@ -115,7 +114,7 @@ public class ComponentUuidFactoryWithMigration implements ComponentUuidFactory {
List<ComponentDto> moduleDtos = dbClient.componentDao()
.selectProjectAndModulesFromProjectKey(dbSession, rootKey, true, branchKey, prKey).stream()
.filter(c -> Qualifiers.MODULE.equals(c.qualifier()))
- .collect(Collectors.toList());
+ .toList();
if (moduleDtos.isEmpty()) {
return Collections.emptyMap();
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java
index b3aeae90cef..6fa5db3068d 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java
@@ -49,9 +49,9 @@ public class VisitorsCrawler implements ComponentCrawler {
}
public VisitorsCrawler(Collection<ComponentVisitor> visitors, boolean computeDuration) {
- List<VisitorWrapper> visitorWrappers = visitors.stream().map(ToVisitorWrapper.INSTANCE).collect(Collectors.toList());
- this.preOrderVisitorWrappers = visitorWrappers.stream().filter(MathPreOrderVisitor.INSTANCE).collect(Collectors.toList());
- this.postOrderVisitorWrappers = visitorWrappers.stream().filter(MatchPostOrderVisitor.INSTANCE).collect(Collectors.toList());
+ List<VisitorWrapper> visitorWrappers = visitors.stream().map(ToVisitorWrapper.INSTANCE).toList();
+ this.preOrderVisitorWrappers = visitorWrappers.stream().filter(MathPreOrderVisitor.INSTANCE).toList();
+ this.postOrderVisitorWrappers = visitorWrappers.stream().filter(MatchPostOrderVisitor.INSTANCE).toList();
this.computeDuration = computeDuration;
this.visitorCumulativeDurations = computeDuration ? visitors.stream().collect(Collectors.toMap(v -> v, v -> new VisitorDuration())) : Collections.emptyMap();
}
@@ -77,8 +77,8 @@ public class VisitorsCrawler implements ComponentCrawler {
private void visitImpl(Component component) {
MatchVisitorMaxDepth visitorMaxDepth = MatchVisitorMaxDepth.forComponent(component);
- List<VisitorWrapper> preOrderVisitorWrappersToExecute = preOrderVisitorWrappers.stream().filter(visitorMaxDepth).collect(Collectors.toList());
- List<VisitorWrapper> postOrderVisitorWrappersToExecute = postOrderVisitorWrappers.stream().filter(visitorMaxDepth).collect(Collectors.toList());
+ List<VisitorWrapper> preOrderVisitorWrappersToExecute = preOrderVisitorWrappers.stream().filter(visitorMaxDepth).toList();
+ List<VisitorWrapper> postOrderVisitorWrappersToExecute = postOrderVisitorWrappers.stream().filter(visitorMaxDepth).toList();
if (preOrderVisitorWrappersToExecute.isEmpty() && postOrderVisitorWrappersToExecute.isEmpty()) {
return;
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java
index 039042216bd..25ad3067ed7 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Configuration;
@@ -76,7 +75,7 @@ public class IntegrateCrossProjectDuplications {
List<CloneGroup> duplications = SuffixTreeCloneDetectionAlgorithm.detect(duplicationIndex, originBlocks);
Iterable<CloneGroup> filtered = duplications.stream()
.filter(getNumberOfUnitsNotLessThan(component.getFileAttributes().getLanguageKey()))
- .collect(Collectors.toList());
+ .toList();
addDuplications(component, filtered);
}
@@ -114,7 +113,7 @@ public class IntegrateCrossProjectDuplications {
.filter(new DoesNotMatchSameComponentKey(originPart.getResourceId()))
.filter(new DuplicateLimiter(file, originPart))
.map(ClonePartToCrossProjectDuplicate.INSTANCE)
- .collect(Collectors.toList());
+ .toList();
}
private NumberOfUnitsNotLessThan getNumberOfUnitsNotLessThan(String language) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java
index 169c0fa6479..14fe9cebfa1 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java
@@ -418,7 +418,7 @@ public class FileMoveDetectionStep implements ComputationStep {
}
public List<Match> filter(Collection<Match> matches) {
- return matches.stream().filter(this::notAlreadyMatched).collect(Collectors.toList());
+ return matches.stream().filter(this::notAlreadyMatched).toList();
}
private boolean notAlreadyMatched(Match input) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java
index fa392c144a3..f1c19139fca 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java
@@ -137,7 +137,7 @@ public class PullRequestFileMoveDetectionStep implements ComputationStep {
.values()
.stream()
.filter(file -> Objects.nonNull(file.getFileAttributes().getOldRelativePath()))
- .collect(toList());
+ .toList();
}
private static Optional<DbComponent> retrieveDbFile(Map<String, DbComponent> dbFilesByPathReference, Component file) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
index 925b55238a6..a27b2857d63 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
@@ -96,7 +96,7 @@ public class ComponentIssuesLoader {
*/
public List<DefaultIssue> loadChanges(DbSession dbSession, Collection<DefaultIssue> issues) {
Map<String, List<IssueChangeDto>> changeDtoByIssueKey = dbClient.issueChangeDao()
- .selectByIssueKeys(dbSession, issues.stream().map(DefaultIssue::key).collect(toList()))
+ .selectByIssueKeys(dbSession, issues.stream().map(DefaultIssue::key).toList())
.stream()
.collect(groupingBy(IssueChangeDto::getIssueKey));
@@ -198,7 +198,7 @@ public class ComponentIssuesLoader {
private void setFilteredChanges(Map<String, List<IssueChangeDto>> changeDtoByIssueKey, DefaultIssue i) {
List<IssueChangeDto> sortedIssueChanges = changeDtoByIssueKey.computeIfAbsent(i.key(), k -> emptyList()).stream()
.sorted(Comparator.comparing(IssueChangeDto::getIssueChangeCreationDate).reversed())
- .collect(toList());
+ .toList();
int statusCount = 0;
int branchCount = 0;
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitor.java
index d9d1c5bcebd..c387af15a56 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitor.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitor.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.sonar.ce.task.projectanalysis.component.Component;
import org.sonar.ce.task.projectanalysis.component.CrawlerDepthLimit;
@@ -96,7 +95,7 @@ public class IntegrateIssuesVisitor extends TypeAwareVisitorAdapter {
var issues = Stream.of(newOpenIssues, existingOpenIssues, closedIssues, copiedIssues)
.flatMap(Collection::stream)
- .collect(Collectors.toList());
+ .toList();
processIssues(component, issues);
issueVisitors.beforeCaching(component);
appendIssuesToCache(cacheAppender, issues);
@@ -141,7 +140,7 @@ public class IntegrateIssuesVisitor extends TypeAwareVisitorAdapter {
// TODO should replace flag "beingClosed" by express call to transition "automaticClose"
issue.setBeingClosed(true)
// TODO manual issues -> was updater.setResolution(newIssue, Issue.RESOLUTION_REMOVED, changeContext);. Is it a problem ?
- ).collect(Collectors.toList());
+ ).toList();
}
private List<DefaultIssue> copyIssues(Map<DefaultIssue, DefaultIssue> matched) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java
index 2d26c60b6df..a91c76eeecb 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Collectors;
import org.sonar.api.issue.Issue;
import org.sonar.ce.task.projectanalysis.component.Component;
import org.sonar.ce.task.projectanalysis.source.NewLinesRepository;
@@ -56,10 +55,10 @@ public class PullRequestTrackerExecution {
Input<DefaultIssue> unmatchedRawsAfterTargetResolvedTracking;
if (targetInputFactory.hasTargetBranchAnalysis()) {
Input<DefaultIssue> targetInput = targetInputFactory.createForTargetBranch(component);
- List<DefaultIssue> resolvedTargetIssues = targetInput.getIssues().stream().filter(i -> Issue.STATUS_RESOLVED.equals(i.status())).collect(Collectors.toList());
+ List<DefaultIssue> resolvedTargetIssues = targetInput.getIssues().stream().filter(i -> Issue.STATUS_RESOLVED.equals(i.status())).toList();
Input<DefaultIssue> resolvedTargetInput = createInput(targetInput, resolvedTargetIssues);
Tracking<DefaultIssue, DefaultIssue> prResolvedTracking = tracker.trackNonClosed(unmatchedRawsAfterChangedLineFiltering, resolvedTargetInput);
- unmatchedRawsAfterTargetResolvedTracking = createInput(rawInput, prResolvedTracking.getUnmatchedRaws().collect(Collectors.toList()));
+ unmatchedRawsAfterTargetResolvedTracking = createInput(rawInput, prResolvedTracking.getUnmatchedRaws().toList());
} else {
unmatchedRawsAfterTargetResolvedTracking = unmatchedRawsAfterChangedLineFiltering;
}
@@ -84,7 +83,7 @@ public class PullRequestTrackerExecution {
final Set<Integer> newLines = newLinesOpt.get();
return issues.stream()
.filter(i -> IssueLocations.allLinesFor(i, component.getUuid()).anyMatch(newLines::contains))
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java
index f7790102949..3c3b80cfefd 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java
@@ -60,7 +60,7 @@ public class SiblingsIssuesLoader {
return dbClient.issueDao().selectOpenByComponentUuids(session, uuids)
.stream()
.map(SiblingsIssuesLoader::toSiblingIssue)
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java
index 8d3cb80dd67..e61c92d2037 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java
@@ -20,7 +20,6 @@
package org.sonar.ce.task.projectanalysis.measure;
import java.util.Objects;
-import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.CheckForNull;
import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper;
@@ -43,6 +42,6 @@ public class MeasureComputersHolderImpl implements MutableMeasureComputersHolder
public void setMeasureComputers(Iterable<MeasureComputerWrapper> measureComputers) {
requireNonNull(measureComputers, "Measure computers cannot be null");
checkState(this.measureComputers == null, "Measure computers have already been initialized");
- this.measureComputers = StreamSupport.stream(measureComputers.spliterator(), false).filter(Objects::nonNull).collect(Collectors.toList());
+ this.measureComputers = StreamSupport.stream(measureComputers.spliterator(), false).filter(Objects::nonNull).toList();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/QualityGateDetailsData.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/QualityGateDetailsData.java
index 48820f986e7..aa7d632a6b2 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/QualityGateDetailsData.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/QualityGateDetailsData.java
@@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.measure.qualitygatedetails;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.List;
-import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.concurrent.Immutable;
import org.sonar.ce.task.projectanalysis.measure.Measure;
@@ -44,7 +43,7 @@ public class QualityGateDetailsData {
this.level = requireNonNull(level);
this.conditions = StreamSupport.stream(conditions.spliterator(), false)
.sorted(new ConditionComparator<>(c -> c.getCondition().getMetric().getKey()))
- .collect(Collectors.toList());
+ .toList();
this.ignoredConditions = ignoredConditions;
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
index 5d826424fb7..2e17ef70a4d 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
@@ -91,7 +91,7 @@ public class MetricRepositoryImpl implements MetricRepository, Startable {
public List<Metric> getMetricsByType(Metric.MetricType type) {
verifyMetricsInitialized();
- return metricsByKey.values().stream().filter(m -> m.getType() == type).collect(Collectors.toList());
+ return metricsByKey.values().stream().filter(m -> m.getType() == type).toList();
}
private void verifyMetricsInitialized() {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java
index fa756e58d8c..299ecb6f7b4 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java
@@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.qualitymodel;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Collectors;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.utils.KeyValueFormat;
import org.sonar.api.utils.log.Logger;
@@ -188,7 +187,7 @@ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<N
.stream()
.filter(entry -> entry.getValue() == 1)
.map(Map.Entry::getKey)
- .collect(Collectors.toList());
+ .toList();
}
public static final class Counter {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java
index f2b856547a0..0763f91c4a5 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
@@ -105,14 +104,14 @@ public class LoadCrossProjectDuplicationsRepositoryStep implements ComputationSt
return;
}
- Collection<String> hashes = cpdTextBlocks.stream().map(CpdTextBlockToHash.INSTANCE).collect(Collectors.toList());
+ Collection<String> hashes = cpdTextBlocks.stream().map(CpdTextBlockToHash.INSTANCE).toList();
List<DuplicationUnitDto> dtos = selectDuplicates(file, hashes);
if (dtos.isEmpty()) {
return;
}
- Collection<Block> duplicatedBlocks = dtos.stream().map(DtoToBlock.INSTANCE).collect(Collectors.toList());
- Collection<Block> originBlocks = cpdTextBlocks.stream().map(new CpdTextBlockToBlock(file.getKey())).collect(Collectors.toList());
+ Collection<Block> duplicatedBlocks = dtos.stream().map(DtoToBlock.INSTANCE).toList();
+ Collection<Block> originBlocks = cpdTextBlocks.stream().map(new CpdTextBlockToBlock(file.getKey())).toList();
LOGGER.trace("Found {} duplicated cpd blocks on file {}", duplicatedBlocks.size(), file.getKey());
integrateCrossProjectDuplications.computeCpd(file, originBlocks, duplicatedBlocks);
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
index 3ddeaa3aafa..70a83570eff 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
@@ -20,7 +20,6 @@
package org.sonar.ce.task.projectanalysis.step;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.batch.BatchReportReader;
@@ -123,7 +122,7 @@ public class LoadDuplicationsFromReportStep implements ComputationStep {
new Duplication(
convert(duplication.getOriginPosition(), id),
duplication.getDuplicateList().stream()
- .map(new BatchDuplicateToCeDuplicate(file)).collect(Collectors.toList())));
+ .map(new BatchDuplicateToCeDuplicate(file)).toList()));
}
private DetailedTextBlock convert(ScannerReport.TextRange textRange, int id) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadMeasureComputersStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadMeasureComputersStep.java
index f17af1b78f8..05d8501dffb 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadMeasureComputersStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadMeasureComputersStep.java
@@ -88,7 +88,7 @@ public class LoadMeasureComputersStep implements ComputationStep {
@Override
public void execute(Context context) {
- List<MeasureComputerWrapper> wrappers = Arrays.stream(measureComputers).map(ToMeasureWrapper.INSTANCE).collect(Collectors.toList());
+ List<MeasureComputerWrapper> wrappers = Arrays.stream(measureComputers).map(ToMeasureWrapper.INSTANCE).toList();
validateMetrics(wrappers);
measureComputersHolder.setMeasureComputers(sortComputers(wrappers));
}
@@ -137,13 +137,13 @@ public class LoadMeasureComputersStep implements ComputationStep {
return measureComputer.getDefinition().getInputMetrics().stream()
.map(toComputerByOutputMetricKey)
.filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
}
private static Collection<MeasureComputerWrapper> getDependents(MeasureComputerWrapper measureComputer, ToComputerByKey toComputerByInputMetricKey) {
return measureComputer.getDefinition().getInputMetrics().stream()
.map(toComputerByInputMetricKey)
- .collect(Collectors.toList());
+ .toList();
}
private static class ToComputerByKey implements Function<String, MeasureComputerWrapper> {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java
index 197e094a547..672fd378a1c 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java
@@ -19,7 +19,6 @@
*/
package org.sonar.ce.task.projectanalysis.step;
-import java.util.stream.Collectors;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.qualitygate.Condition;
import org.sonar.ce.task.projectanalysis.qualitygate.MutableQualityGateHolder;
@@ -56,7 +55,7 @@ public class LoadQualityGateStep implements ComputationStep {
}
private static QualityGate filterQGForPR(QualityGate qg) {
- return new QualityGate(qg.getUuid(), qg.getName(), qg.getConditions().stream().filter(Condition::useVariation).collect(Collectors.toList()));
+ return new QualityGate(qg.getUuid(), qg.getName(), qg.getConditions().stream().filter(Condition::useVariation).toList());
}
private QualityGate getProjectQualityGate() {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistEventsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistEventsStep.java
index ec1d1434b60..51677f0fb4f 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistEventsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistEventsStep.java
@@ -21,7 +21,6 @@ package org.sonar.ce.task.projectanalysis.step;
import java.util.Objects;
import java.util.function.Function;
-import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.sonar.api.utils.System2;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
@@ -95,7 +94,7 @@ public class PersistEventsStep implements ComputationStep {
.setDescription(event.getDescription())
.setData(event.getData());
// FIXME bulk insert
- for (EventDto batchEventDto : StreamSupport.stream(eventRepository.getEvents(component).spliterator(), false).map(eventToEventDto).collect(Collectors.toList())) {
+ for (EventDto batchEventDto : StreamSupport.stream(eventRepository.getEvents(component).spliterator(), false).map(eventToEventDto).toList()) {
dbClient.eventDao().insert(session, batchEventDto);
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
index e0ae3f266cf..35b98f14122 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
@@ -220,8 +220,8 @@ public class SendIssueNotificationsStep implements ComputationStep {
private Map<String, UserDto> loadUserDtoByUuid(NewIssuesStatistics statistics) {
List<Map.Entry<String, NewIssuesStatistics.Stats>> entriesWithIssuesOnLeak = statistics.getAssigneesStatistics().entrySet()
- .stream().filter(e -> e.getValue().hasIssuesOnCurrentAnalysis()).collect(toList());
- List<String> assigneeUuids = entriesWithIssuesOnLeak.stream().map(Map.Entry::getKey).collect(toList());
+ .stream().filter(e -> e.getValue().hasIssuesOnCurrentAnalysis()).toList();
+ List<String> assigneeUuids = entriesWithIssuesOnLeak.stream().map(Map.Entry::getKey).toList();
try (DbSession dbSession = dbClient.openSession(false)) {
return dbClient.userDao().selectByUuids(dbSession, assigneeUuids).stream().collect(toMap(UserDto::getUuid, u -> u));
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java
index d136db96027..b8aeebc7cfd 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java
@@ -29,7 +29,6 @@ import java.sql.SQLException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.utils.log.Loggers;
import org.sonar.ce.task.projectexport.component.ComponentRepository;
@@ -197,7 +196,7 @@ public class ExportIssuesStep implements ComputationStep {
.setStart(e.getStart())
.setEnd(e.getEnd())
.setType(ProjectDump.MessageFormattingType.valueOf(e.getType().name())).build())
- .collect(Collectors.toList());
+ .toList();
}
private static class RuleRegistrar {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java
index 31817fed2c5..0b4e582c591 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java
@@ -22,7 +22,6 @@ package org.sonar.ce.task.projectexport.steps;
import com.sonarsource.governance.projectdump.protobuf.ProjectDump;
import java.util.List;
import java.util.Set;
-import java.util.stream.Collectors;
import org.sonar.api.utils.log.Loggers;
import org.sonar.ce.task.projectexport.component.ComponentRepository;
import org.sonar.ce.task.step.ComputationStep;
@@ -66,7 +65,7 @@ public class ExportSettingsStep implements ComputationStep {
.stream()
.filter(dto -> dto.getComponentUuid() != null)
.filter(dto -> !IGNORED_KEYS.contains(dto.getKey()))
- .collect(Collectors.toList());
+ .toList();
for (PropertyDto property : properties) {
builder.clear()
.setKey(property.getKey())
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java
index 35005c44579..91ee2234dc0 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java
@@ -164,7 +164,7 @@ public class MetricRepositoryImplTest {
public void get_all_metrics() {
List<MetricDto> enabledMetrics = IntStream.range(0, 1 + new Random().nextInt(12))
.mapToObj(i -> dbTester.measures().insertMetric(t -> t.setKey("key_enabled_" + i).setEnabled(true)))
- .collect(Collectors.toList());
+ .toList();
IntStream.range(0, 1 + new Random().nextInt(12))
.forEach(i -> dbTester.measures().insertMetric(t -> t.setKey("key_disabled_" + i).setEnabled(false)));
@@ -178,7 +178,7 @@ public class MetricRepositoryImplTest {
public void getMetricsByType_givenRatingType_returnRatingMetrics() {
List<MetricDto> enabledMetrics = IntStream.range(0, 1 + new Random().nextInt(12))
.mapToObj(i -> dbTester.measures().insertMetric(t -> t.setKey("key_enabled_" + i).setEnabled(true).setValueType("RATING")))
- .collect(Collectors.toList());
+ .toList();
underTest.start();
assertThat(underTest.getMetricsByType(Metric.MetricType.RATING))
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
index 426887ee0c3..8d788b1c6d8 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
@@ -607,7 +607,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest {
List<DefaultIssue> issues = IntStream.range(0, 2001 + new Random().nextInt(10))
.mapToObj(i -> newIssue(ruleDefinitionDto, project, file).setKee("uuid_" + i).setType(randomTypeExceptHotspot).toDefaultIssue()
.setNew(false).setChanged(true).setSendNotifications(true).setAssigneeUuid(user.getUuid()))
- .collect(toList());
+ .toList();
DiskCache.CacheAppender cacheAppender = protoIssueCache.newAppender();
issues.forEach(cacheAppender::append);
cacheAppender.close();
diff --git a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepoEntry.java b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepoEntry.java
index 46c33fab746..306551d95dd 100644
--- a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepoEntry.java
+++ b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepoEntry.java
@@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.measure;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.sonar.ce.task.projectanalysis.component.Component;
@@ -61,7 +60,7 @@ public final class MeasureRepoEntry {
}
public static Iterable<MeasureRepoEntry> toEntries(Map<String, Measure> data) {
- return data.entrySet().stream().map(toMeasureRepoEntry()).collect(Collectors.toList());
+ return data.entrySet().stream().map(toMeasureRepoEntry()).toList();
}
public static MeasureRepoEntry entryOf(String metricKey, Measure measure) {
diff --git a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
index c7c8dbd803f..f012aa78c16 100644
--- a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
+++ b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
@@ -23,8 +23,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.stream.Collectors;
-
import org.junit.rules.ExternalResource;
import static com.google.common.base.Preconditions.checkState;
@@ -118,6 +116,6 @@ public class MetricRepositoryRule extends ExternalResource implements MetricRepo
@Override
public List<Metric> getMetricsByType(Metric.MetricType type) {
- return metricsByKey.values().stream().filter(m -> m.getType() == type).collect(Collectors.toList());
+ return metricsByKey.values().stream().filter(m -> m.getType() == type).toList();
}
}
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java
index cac5d41570d..e8ff259765d 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java
@@ -21,7 +21,6 @@ package org.sonar.ce.monitoring;
import java.util.List;
import java.util.Set;
-import java.util.stream.Collectors;
import org.sonar.api.Startable;
import org.sonar.ce.configuration.CeConfiguration;
import org.sonar.ce.taskprocessor.CeWorker;
@@ -103,7 +102,7 @@ public class CeTasksMBeanImpl implements CeTasksMBean, Startable, SystemInfoSect
return workers.stream()
.map(CeWorker::getUUID)
.sorted()
- .collect(Collectors.toList());
+ .toList();
}
@Override
@@ -113,7 +112,7 @@ public class CeTasksMBeanImpl implements CeTasksMBean, Startable, SystemInfoSect
.filter(ceWorkerController::isEnabled)
.map(CeWorker::getUUID)
.sorted()
- .collect(Collectors.toList());
+ .toList();
}
@Override
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java
index 0a4f53ea1a0..4bd038ece4f 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java
@@ -110,7 +110,7 @@ public class NextPendingTaskPicker {
private static List<PrOrBranchTask> filterOldestPerProject(List<PrOrBranchTask> queuedPrOrBranches) {
Set<String> mainComponentUuidsSeen = new HashSet<>();
- return queuedPrOrBranches.stream().filter(t -> mainComponentUuidsSeen.add(t.getMainComponentUuid())).collect(toList());
+ return queuedPrOrBranches.stream().filter(t -> mainComponentUuidsSeen.add(t.getMainComponentUuid())).toList();
}
/**
@@ -124,7 +124,7 @@ public class NextPendingTaskPicker {
String mainComponentUuid = task.getMainComponentUuid();
List<PrOrBranchTask> sameComponentTasks = inProgress.stream()
.filter(t -> t.getMainComponentUuid().equals(mainComponentUuid))
- .collect(toList());
+ .toList();
//we can peek branch analysis task only if all the other in progress tasks for this component uuid are pull requests
return sameComponentTasks.stream().map(PrOrBranchTask::getBranchType).allMatch(s -> Objects.equals(s, PULL_REQUEST));
}
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 f09ae4a1191..782981eacad 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
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.System2;
@@ -199,7 +198,7 @@ public class PurgeDao implements Dao {
List<String> branchUuids = session.getMapper(BranchMapper.class).selectByProjectUuid(uuid).stream()
.map(BranchDto::getUuid)
.filter(branchUuid -> !uuid.equals(branchUuid))
- .collect(Collectors.toList());
+ .toList();
branchUuids.forEach(id -> deleteRootComponent(id, purgeMapper, purgeCommands));
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java
index 9a04bb540b3..8a332eeba65 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java
@@ -28,7 +28,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
-import java.util.stream.Collectors;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rules.RuleQuery;
import org.sonar.core.util.UuidFactory;
@@ -159,7 +158,7 @@ public class RuleDao implements Dao {
List<String> templateRuleUuids = ruleDtos.stream()
.map(RuleDto::getTemplateUuid)
.filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
Map<String, RuleDto> templateDtos = findTemplateDtos(mapper, templateRuleUuids);
ruleDtos.stream().map(r -> toRuleForIndexingDto(r, templateDtos)).forEach(consumer);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java
index 12df2a2a179..22beed6aea9 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java
@@ -95,7 +95,7 @@ public class UserDao implements Dao {
return logins.stream()
.map(new LoginToUser(unordered))
.filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
}
public List<UserDto> selectUsers(DbSession dbSession, UserQuery query) {
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java
index 8eb96fe9eda..789584f4406 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java
@@ -25,7 +25,6 @@ import com.tngtech.java.junit.dataprovider.UseDataProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
@@ -129,7 +128,7 @@ public class ScrollForFileMoveComponentDaoTest {
FileSourceDto fileSource = db.fileSources().insertFileSource(file);
return new ComponentAndSource(file, fileSource);
})
- .collect(Collectors.toList());
+ .toList();
RecordingResultHandler resultHandler = new RecordingResultHandler();
underTest.scrollAllFilesForFileMove(dbSession, project.uuid(), resultHandler);
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
index d62e758b6f8..04b691f84d2 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
@@ -230,7 +230,7 @@ public class SnapshotDaoTest {
.mapToObj(j -> db.components().insertSnapshot(project));
})
.flatMap(t -> t)
- .collect(toList());
+ .toList();
assertThat(underTest.selectAnalysesByQuery(db.getSession(), new SnapshotQuery()))
.extracting(SnapshotDto::getUuid)
@@ -244,10 +244,10 @@ public class SnapshotDaoTest {
ComponentDto project2 = db.components().insertPrivateProject();
List<SnapshotDto> snapshots1 = IntStream.range(0, 1 + random.nextInt(20))
.mapToObj(j -> db.components().insertSnapshot(project1))
- .collect(toList());
+ .toList();
List<SnapshotDto> snapshots2 = IntStream.range(0, 1 + random.nextInt(20))
.mapToObj(j -> db.components().insertSnapshot(project2))
- .collect(toList());
+ .toList();
assertThat(underTest.selectAnalysesByQuery(db.getSession(), new SnapshotQuery().setComponentUuid(project1.uuid())))
.extracting(SnapshotDto::getUuid)
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java
index c0c804091ee..6c41d79d051 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java
@@ -152,7 +152,7 @@ public class EventDaoTest {
SnapshotDto analysis = dbTester.components().insertProjectAndSnapshot(project);
List<EventDto> events = IntStream.range(0, 1 + new Random().nextInt(10))
.mapToObj(i -> dbTester.events().insertEvent(newEvent(analysis).setCategory("cat_" + i)))
- .collect(toList());
+ .toList();
List<EventDto> dtos = underTest.selectByComponentUuid(dbTester.getSession(), project.uuid());
assertThat(dtos)
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java
index 951733e8d82..b8da7e7bc35 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java
@@ -24,7 +24,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
-import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.Rule;
import org.junit.Test;
@@ -72,10 +71,10 @@ public class MetricDaoTest {
public void find_all_enabled() {
List<MetricDto> enabledMetrics = IntStream.range(0, 1 + new Random().nextInt(10))
.mapToObj(i -> MetricTesting.newMetricDto().setEnabled(true))
- .collect(Collectors.toList());
+ .toList();
List<MetricDto> disabledMetrics = IntStream.range(0, 1 + new Random().nextInt(10))
.mapToObj(i -> MetricTesting.newMetricDto().setEnabled(false))
- .collect(Collectors.toList());
+ .toList();
List<MetricDto> all = new ArrayList<>(enabledMetrics);
all.addAll(disabledMetrics);
@@ -92,10 +91,10 @@ public class MetricDaoTest {
public void find_all() {
List<MetricDto> enabledMetrics = IntStream.range(0, 1 + new Random().nextInt(10))
.mapToObj(i -> MetricTesting.newMetricDto().setEnabled(true))
- .collect(Collectors.toList());
+ .toList();
List<MetricDto> disabledMetrics = IntStream.range(0, 1 + new Random().nextInt(10))
.mapToObj(i -> MetricTesting.newMetricDto().setEnabled(false))
- .collect(Collectors.toList());
+ .toList();
List<MetricDto> all = new ArrayList<>(enabledMetrics);
all.addAll(disabledMetrics);
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
index 28699396ba9..b48926f58a9 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
@@ -475,7 +475,7 @@ public class AuthorizationDaoTest {
@Test
public void keepAuthorizedProjectUuids_should_be_able_to_handle_lots_of_projects() {
- List<ComponentDto> projects = IntStream.range(0, 2000).mapToObj(i -> db.components().insertPublicProject()).collect(Collectors.toList());
+ List<ComponentDto> projects = IntStream.range(0, 2000).mapToObj(i -> db.components().insertPublicProject()).toList();
Collection<String> uuids = projects.stream().map(ComponentDto::uuid).collect(Collectors.toSet());
assertThat(underTest.keepAuthorizedProjectUuids(dbSession, uuids, null, UserRole.USER))
@@ -665,7 +665,7 @@ public class AuthorizationDaoTest {
@Test
public void keepAuthorizedUsersForRoleAndProject_should_be_able_to_handle_lots_of_users() {
- List<UserDto> users = IntStream.range(0, 2000).mapToObj(i -> db.users().insertUser()).collect(Collectors.toList());
+ List<UserDto> users = IntStream.range(0, 2000).mapToObj(i -> db.users().insertUser()).toList();
assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession,
users.stream().map(UserDto::getUuid).collect(Collectors.toSet()), "user", PROJECT_UUID)).isEmpty();
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java
index 8ab7e6fdd32..01398aec0c3 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java
@@ -242,7 +242,7 @@ public class FileSourceDaoTest {
dbTester.fileSources().insertFileSource(file);
return file;
})
- .collect(Collectors.toList());
+ .toList();
Map<String, FileHashesDto> fileSourcesByUuid = new HashMap<>();
underTest.scrollFileHashesByProjectUuid(dbSession, project.branchUuid(), result -> fileSourcesByUuid.put(result.getResultObject().getFileUuid(), result.getResultObject()));
@@ -279,7 +279,7 @@ public class FileSourceDaoTest {
dbTester.fileSources().insertFileSource(file);
return file;
})
- .collect(Collectors.toList());
+ .toList();
LineHashesWithKeyDtoHandler handler = new LineHashesWithKeyDtoHandler();
underTest.scrollLineHashes(dbSession, files.stream().map(ComponentDto::uuid).collect(Collectors.toSet()), handler);
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/webhook/WebhookDeliveryTesting.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/webhook/WebhookDeliveryTesting.java
index c0b1cfc2a61..ae149ffefc9 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/webhook/WebhookDeliveryTesting.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/webhook/WebhookDeliveryTesting.java
@@ -20,7 +20,6 @@
package org.sonar.db.webhook;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.core.util.Uuids;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
@@ -68,6 +67,6 @@ public class WebhookDeliveryTesting {
return dbTester.select(dbSession, "select uuid as \"uuid\" from webhook_deliveries")
.stream()
.map(columns -> (String) columns.get("uuid"))
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java
index db79e606916..2e5ad96bb3f 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java
@@ -24,7 +24,6 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
@@ -75,7 +74,7 @@ class MssqlCharsetHandler extends CharsetHandler {
// Example of row:
// issues | kee | Latin1_General_CS_AS or Latin1_General_100_CI_AS_KS_WS
List<ColumnDef> columns = metadata.getColumnDefs(connection);
- for (ColumnDef column : columns.stream().filter(ColumnDef::isInSonarQubeTable).collect(Collectors.toList())) {
+ for (ColumnDef column : columns.stream().filter(ColumnDef::isInSonarQubeTable).toList()) {
String collation = column.getCollation();
if (!isCollationCorrect(collation)) {
repairColumnCollation(connection, column, toCaseSensitive(collation));
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/AddPrimaryKeyBuilder.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/AddPrimaryKeyBuilder.java
index cf60fdbee1e..6e66dc03708 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/AddPrimaryKeyBuilder.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/AddPrimaryKeyBuilder.java
@@ -22,7 +22,6 @@ package org.sonar.server.platform.db.migration.sql;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Objects;
-import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkState;
import static java.lang.String.format;
@@ -36,7 +35,7 @@ public class AddPrimaryKeyBuilder {
public AddPrimaryKeyBuilder(String tableName, String column, String... moreColumns) {
this.tableName = validateTableName(tableName);
- this.primaryKey = Lists.asList(column, moreColumns).stream().filter(Objects::nonNull).collect(Collectors.toList());
+ this.primaryKey = Lists.asList(column, moreColumns).stream().filter(Objects::nonNull).toList();
}
public String build() {
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java
index 7343fc5a979..2b9b3561fca 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java
@@ -78,7 +78,7 @@ public class CreateTableAsBuilder {
sql.add(sb.toString());
}
- List<Column> notNullColumns = columns.stream().filter(c -> !c.definition().isNullable()).collect(Collectors.toList());
+ List<Column> notNullColumns = columns.stream().filter(c -> !c.definition().isNullable()).toList();
for (Column c : notNullColumns) {
sql.addAll(new AlterColumnsBuilder(dialect, tableName).updateColumn(c.definition()).build());
}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java
index 796e2281913..320241f0c79 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java
@@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.sql;
import java.util.ArrayList;
import java.util.List;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import org.sonar.db.dialect.Dialect;
import org.sonar.db.dialect.H2;
@@ -81,7 +80,7 @@ public class RenameColumnsBuilder {
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
}
- }).collect(Collectors.toList());
+ }).toList();
}
private static class Renaming implements ColumnDef {
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/MigratePortfoliosToNewTables.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/MigratePortfoliosToNewTables.java
index c7c01bce421..1c2cd028bd1 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/MigratePortfoliosToNewTables.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/MigratePortfoliosToNewTables.java
@@ -37,7 +37,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.xml.XMLConstants;
@@ -252,7 +251,7 @@ public class MigratePortfoliosToNewTables extends DataChange {
private static List<String> findConsistencyErrors(Collection<ViewDef> portfolios, Map<String, PortfolioDb> portfolioDbMap) {
return portfolios.stream()
.flatMap(portfolio -> findConsistencyErrors(portfolio, portfolioDbMap).stream())
- .collect(Collectors.toList());
+ .toList();
}
private static List<String> findConsistencyErrors(ViewDef portfolio, Map<String, PortfolioDb> portfolioDbMap) {
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
index 06030298dfe..ea0a4ded5f9 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.process.MessageException;
@@ -68,7 +67,7 @@ public class JvmOptions<T extends JvmOptions> {
public T addFromMandatoryProperty(Props props, String propertyName) {
String value = props.nonNullValue(propertyName);
if (!value.isEmpty()) {
- List<String> jvmOptions = Arrays.stream(value.split(" (?=-)")).map(String::trim).collect(Collectors.toList());
+ List<String> jvmOptions = Arrays.stream(value.split(" (?=-)")).map(String::trim).toList();
checkOptionFormat(propertyName, jvmOptions);
checkMandatoryOptionOverwrite(propertyName, jvmOptions);
options.addAll(jvmOptions);
@@ -80,7 +79,7 @@ public class JvmOptions<T extends JvmOptions> {
private static void checkOptionFormat(String propertyName, List<String> jvmOptionsFromProperty) {
List<String> invalidOptions = jvmOptionsFromProperty.stream()
.filter(JvmOptions::isInvalidOption)
- .collect(Collectors.toList());
+ .toList();
if (!invalidOptions.isEmpty()) {
throw new MessageException(format(
"a JVM option can't be empty and must start with '-'. The following JVM options defined by property '%s' are invalid: %s",
@@ -94,7 +93,7 @@ public class JvmOptions<T extends JvmOptions> {
List<Match> matches = jvmOptionsFromProperty.stream()
.map(jvmOption -> new Match(jvmOption, mandatoryOptionFor(jvmOption)))
.filter(match -> match.getMandatoryOption() != null)
- .collect(Collectors.toList());
+ .toList();
if (!matches.isEmpty()) {
throw new MessageException(format(
"a JVM option can't overwrite mandatory JVM options. The following JVM options defined by property '%s' are invalid: %s",
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 adf4ae26538..5236014a1b4 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
@@ -42,7 +42,6 @@ import static java.util.Arrays.stream;
import static java.util.Collections.singleton;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.joining;
-import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static org.sonar.process.ProcessProperties.Property.AUTH_JWT_SECRET;
import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
@@ -146,7 +145,7 @@ public class ClusterSettings implements Consumer<Props> {
.map(AddressAndPort::getHost)
.filter(t -> !network.toInetAddress(t).isPresent())
.sorted()
- .collect(toList());
+ .toList();
if (!invalidHosts.isEmpty()) {
throw new MessageException(format("Address in property %s is not a valid address: %s",
property.getKey(), String.join(", ", invalidHosts)));
@@ -187,7 +186,7 @@ public class ClusterSettings implements Consumer<Props> {
List<String> violations = FORBIDDEN_SEARCH_NODE_SETTINGS.stream()
.filter(setting -> props.value(setting.getKey()) != null)
.map(Property::getKey)
- .collect(toList());
+ .toList();
if (!violations.isEmpty()) {
throw new MessageException(format("Properties [%s] are not allowed when running SonarQube in cluster mode.", String.join(", ", violations)));
diff --git a/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java b/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java
index 4333f157c11..2ccaffd6017 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java
@@ -25,7 +25,6 @@ import com.hazelcast.config.MemberAttributeConfig;
import com.hazelcast.config.NetworkConfig;
import com.hazelcast.core.Hazelcast;
import java.util.List;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.sonar.process.ProcessId;
import org.sonar.process.cluster.hz.HazelcastMember.Attribute;
@@ -110,7 +109,7 @@ public class HazelcastMemberBuilder {
.filter(host -> !host.isBlank())
.map(String::trim)
.map(HazelcastMemberBuilder::applyDefaultPortToHost)
- .collect(Collectors.toList());
+ .toList();
joinConfig.getTcpIpConfig().setEnabled(true);
joinConfig.getTcpIpConfig().setMembers(requireNonNull(addressesWithDefaultPorts, "Members are missing"));
}
diff --git a/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java b/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
index bdae5ae72a8..93a841f61b6 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
@@ -184,7 +184,7 @@ public class Log4JPropertiesBuilder extends AbstractLogHelper {
.filter(loggerName -> !ROOT_LOGGER_NAME.equals(loggerName))
.distinct()
.sorted()
- .collect(Collectors.toList());
+ .toList();
if (!loggerNames.isEmpty()) {
putProperty("loggers", loggerNames.stream().collect(Collectors.joining(",")));
}
diff --git a/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java b/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java
index 9afd9d286d3..a687897662b 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java
@@ -27,7 +27,6 @@ import java.util.HashSet;
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.process.ProcessId;
@@ -107,7 +106,7 @@ public final class LogLevelConfig {
private void levelByProperty(String loggerName, String property, String... otherProperties) {
ensureUniqueConfiguration(loggerName);
- configuredByProperties.put(loggerName, Stream.concat(Stream.of(property), Arrays.stream(otherProperties)).collect(Collectors.toList()));
+ configuredByProperties.put(loggerName, Stream.concat(Stream.of(property), Arrays.stream(otherProperties)).toList());
}
/**
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java
index c1dd7164524..47427d9dde1 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java
@@ -80,7 +80,7 @@ public class EsClientProvider {
return Arrays.stream(config.getStringArray(CLUSTER_SEARCH_HOSTS.getKey()))
.map(HostAndPort::fromString)
.map(EsClientProvider::toHttpHost)
- .collect(Collectors.toList());
+ .toList();
}
private static HttpHost toHttpHost(HostAndPort host) {
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/ProjectIndexers.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/ProjectIndexers.java
index f7fdb2dcff4..87650398e93 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/es/ProjectIndexers.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/ProjectIndexers.java
@@ -20,7 +20,6 @@
package org.sonar.server.es;
import java.util.Collection;
-import java.util.stream.Collectors;
import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbSession;
import org.sonar.db.component.BranchDto;
@@ -54,7 +53,7 @@ public interface ProjectIndexers {
default void commitAndIndexBranches(DbSession dbSession, Collection<BranchDto> branches, ProjectIndexer.Cause cause) {
Collection<String> branchUuids = branches.stream()
.map(BranchDto::getUuid)
- .collect(Collectors.toList());
+ .toList();
commitAndIndexByProjectUuids(dbSession, branchUuids, cause);
}
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/searchrequest/RequestFiltersComputer.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/searchrequest/RequestFiltersComputer.java
index 1759226c775..ca67ccc83e8 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/es/searchrequest/RequestFiltersComputer.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/searchrequest/RequestFiltersComputer.java
@@ -27,7 +27,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiPredicate;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@@ -162,7 +161,7 @@ public class RequestFiltersComputer {
List<QueryBuilder> selectQueryBuilders = queryFilters.entrySet().stream()
.filter(e -> predicate.test(e.getKey(), e.getValue()))
.map(Map.Entry::getValue)
- .collect(Collectors.toList());
+ .toList();
if (selectQueryBuilders.isEmpty()) {
return empty();
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
index cac3cd87945..e3dca59c8e2 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import org.sonar.api.config.Configuration;
import org.sonar.api.rules.RuleType;
@@ -62,7 +61,7 @@ public class TaintChecker {
private List<IssueDto> filterTaintIssues(List<IssueDto> issues, boolean returnTaint) {
return issues.stream()
.filter(getTaintIssueFilter(returnTaint))
- .collect(Collectors.toList());
+ .toList();
}
@NotNull
@@ -85,7 +84,7 @@ public class TaintChecker {
return repositories;
}
- repositories.addAll(Arrays.stream(config.getStringArray(EXTRA_TAINT_REPOSITORIES)).collect(Collectors.toList()));
+ repositories.addAll(Arrays.stream(config.getStringArray(EXTRA_TAINT_REPOSITORIES)).toList());
return repositories;
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java
index 6eb8842a2c0..fdf51ff032c 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java
@@ -25,7 +25,6 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import org.sonar.api.issue.Issue;
@@ -57,7 +56,7 @@ public class State {
return Arrays.stream(outTransitions)
.filter(transition -> !transition.automatic())
.filter(transition -> transition.supports(issue))
- .collect(Collectors.toList());
+ .toList();
}
@CheckForNull
@@ -65,7 +64,7 @@ public class State {
List<Transition> transitions = Arrays.stream(outTransitions)
.filter(Transition::automatic)
.filter(t -> t.supports(issue))
- .collect(Collectors.toList());
+ .toList();
if(transitions.size() > 1){
throw new IllegalArgumentException("Several automatic transitions are available for issue: " + issue);
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/metric/MetricFinder.java b/server/sonar-server-common/src/main/java/org/sonar/server/metric/MetricFinder.java
index 32adffd1441..41e0a620f5b 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/metric/MetricFinder.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/metric/MetricFinder.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.sonar.api.measures.Metric;
import org.sonar.db.DbClient;
@@ -62,14 +61,14 @@ public class MetricFinder {
public Collection<Metric> findAll(List<String> metricKeys) {
try (DbSession session = dbClient.openSession(false)) {
List<MetricDto> dtos = dbClient.metricDao().selectByKeys(session, metricKeys);
- return dtos.stream().filter(IsEnabled.INSTANCE).map(ToMetric.INSTANCE).collect(Collectors.toList());
+ return dtos.stream().filter(IsEnabled.INSTANCE).map(ToMetric.INSTANCE).toList();
}
}
public Collection<Metric> findAll() {
try (DbSession session = dbClient.openSession(false)) {
List<MetricDto> dtos = dbClient.metricDao().selectEnabled(session);
- return dtos.stream().map(ToMetric.INSTANCE).collect(Collectors.toList());
+ return dtos.stream().map(ToMetric.INSTANCE).toList();
}
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProvider.java b/server/sonar-server-common/src/main/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProvider.java
index 4ad6a73815f..ef0a870ae6c 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProvider.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProvider.java
@@ -21,7 +21,6 @@ package org.sonar.server.platform.monitoring.cluster;
import java.util.Arrays;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.Startable;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
@@ -40,7 +39,7 @@ public class ProcessInfoProvider implements Startable {
public ProcessInfoProvider(SystemInfoSection[] sections) {
this.sections = Arrays.stream(sections)
.filter(section -> !(section instanceof Global))
- .collect(Collectors.toList());
+ .toList();
}
@Override
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/QPMeasureData.java b/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/QPMeasureData.java
index 154e0c829bb..0512e88e685 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/QPMeasureData.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/QPMeasureData.java
@@ -26,7 +26,6 @@ import java.io.StringWriter;
import java.util.Comparator;
import java.util.Map;
import java.util.SortedSet;
-import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.concurrent.Immutable;
import org.sonar.api.utils.text.JsonWriter;
@@ -57,7 +56,7 @@ public class QPMeasureData {
jsonProfile.get("name").getAsString(),
jsonProfile.get("language").getAsString(),
UtcDateUtils.parseDateTime(jsonProfile.get("rulesUpdatedAt").getAsString()));
- }).collect(Collectors.toList()));
+ }).toList());
}
public static String toJson(QPMeasureData data) {
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java b/server/sonar-server-common/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
index fb6ea87e7bc..ddd8886a0f2 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
@@ -28,7 +28,6 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import org.sonar.api.rule.RuleKey;
@@ -122,7 +121,7 @@ public class DefaultRuleFinder implements ServerRuleFinder {
private Collection<org.sonar.api.rules.Rule> convertToRuleApi(DbSession dbSession, List<RuleDto> ruleDtos) {
List<org.sonar.api.rules.Rule> rules = new ArrayList<>();
- List<RuleKey> ruleKeys = ruleDtos.stream().map(RuleDto::getKey).collect(Collectors.toList());
+ List<RuleKey> ruleKeys = ruleDtos.stream().map(RuleDto::getKey).toList();
List<RuleParamDto> ruleParamDtos = ruleDao.selectRuleParamsByRuleKeys(dbSession, ruleKeys);
ImmutableListMultimap<String, RuleParamDto> ruleParamByRuleUuid = FluentIterable.from(ruleParamDtos).index(RuleParamDtoToRuleUuid.INSTANCE);
for (RuleDto rule : ruleDtos) {
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 2a5db2167ba..7e1880b481f 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
@@ -111,12 +111,12 @@ public final class SecurityStandards {
"6.3.2", "6.4.1", "6.4.2", "7.1.3", "7.1.4", "7.2.1", "7.2.2", "7.3.1", "7.3.2", "7.3.3", "7.3.4", "7.4.2", "7.4.3", "8.1.1", "8.1.2", "8.1.3", "8.1.4", "8.3.5", "8.3.6",
"8.3.7", "8.3.8", "9.2.1", "9.2.2", "9.2.3", "9.2.4", "10.2.1", "10.2.2", "11.1.6", "11.1.7", "11.1.8", "12.1.2", "12.1.3", "12.2.1", "12.3.6", "13.1.4", "13.1.5", "13.2.4",
"13.2.5", "13.2.6", "13.3.2", "13.4.1", "13.4.2", "14.1.1", "14.1.2", "14.1.3", "14.1.4", "14.2.4", "14.2.5", "14.2.6", "14.5.4"), OWASP_ASVS_40_LEVEL_1.stream())
- .collect(Collectors.toList()));
+ .toList());
public static final List<String> OWASP_ASVS_40_LEVEL_3 = Collections.unmodifiableList(Stream
.concat(Stream.of("1.11.3", "2.2.4", "2.2.5", "2.2.6", "2.2.7", "2.8.7", "3.6.1", "3.6.2", "6.2.7", "6.2.8", "6.3.3", "8.1.5",
"8.1.6", "9.2.5", "10.1.1", "10.2.3", "10.2.4", "10.2.5", "10.2.6", "14.1.5"), OWASP_ASVS_40_LEVEL_2.stream())
- .collect(Collectors.toList()));
+ .toList());
public static final Map<Integer, List<String>> OWASP_ASVS_40_REQUIREMENTS_BY_LEVEL = Map.of(
1, OWASP_ASVS_40_LEVEL_1,
@@ -252,8 +252,8 @@ public final class SecurityStandards {
.put(SQCategory.TRACEABILITY, Set.of("778"))
.put(SQCategory.PERMISSION, Set.of("266", "269", "284", "668", "732"))
.build();
- private static final Ordering<SQCategory> SQ_CATEGORY_ORDERING = Ordering.explicit(stream(SQCategory.values()).collect(Collectors.toList()));
- public static final Ordering<String> SQ_CATEGORY_KEYS_ORDERING = Ordering.explicit(stream(SQCategory.values()).map(SQCategory::getKey).collect(Collectors.toList()));
+ private static final Ordering<SQCategory> SQ_CATEGORY_ORDERING = Ordering.explicit(stream(SQCategory.values()).toList());
+ public static final Ordering<String> SQ_CATEGORY_KEYS_ORDERING = Ordering.explicit(stream(SQCategory.values()).map(SQCategory::getKey).toList());
private final Set<String> standards;
private final Set<String> cwe;
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/NetworkInterfaceProvider.java b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/NetworkInterfaceProvider.java
index 063f5773ac3..e2788ce5126 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/NetworkInterfaceProvider.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/NetworkInterfaceProvider.java
@@ -24,7 +24,6 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
@@ -36,6 +35,6 @@ public class NetworkInterfaceProvider {
return Collections.list(NetworkInterface.getNetworkInterfaces())
.stream()
.flatMap(ni -> Collections.list(ni.getInetAddresses()).stream())
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java
index 552bcea778f..59cd39923b4 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java
@@ -31,7 +31,6 @@ import org.sonar.server.es.newindex.SettingsConfiguration;
import org.sonar.server.es.newindex.TestNewIndex;
import org.sonar.server.es.newindex.TypeMapping;
-import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
@@ -277,14 +276,14 @@ public class IndexDefinitionHashTest {
consumer.accept(mainTypeMapping.getMainTypeMapping());
return mainTypeMapping;
})
- .collect(toList());
+ .toList();
List<TestNewIndex> relationIndices = fieldTypes1.stream()
.map(consumer -> {
TestNewIndex relationTypeMapping = new TestNewIndex(mainType, settingsConfiguration);
consumer.accept(relationTypeMapping.createRelationMapping("donut"));
return relationTypeMapping;
})
- .collect(toList());
+ .toList();
Set<String> mainHashes = mainIndices.stream()
.map(IndexDefinitionHashTest::hashOf)
@@ -313,14 +312,14 @@ public class IndexDefinitionHashTest {
consumer.accept(mainTypeMapping.getMainTypeMapping());
return mainTypeMapping;
})
- .collect(toList());
+ .toList();
List<TestNewIndex> relationIndices = Arrays.stream(fieldTypes)
.map(consumer -> {
TestNewIndex relationTypeMapping = new TestNewIndex(mainType, settingsConfiguration);
consumer.accept(relationTypeMapping.createRelationMapping("donut"));
return relationTypeMapping;
})
- .collect(toList());
+ .toList();
Set<String> mainHashes = mainIndices.stream()
.map(IndexDefinitionHashTest::hashOf)
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java
index 02c93883756..2dfa88bf164 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java
@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Random;
-import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import javax.annotation.CheckForNull;
@@ -119,7 +118,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_component_on_current_analysis_globally_and_per_assignee() {
- List<String> componentUuids = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> componentUuids = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
String assignee = randomAlphanumeric(10);
componentUuids.stream()
.map(componentUuid -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setComponentUuid(componentUuid).setAssigneeUuid(assignee).setNew(true))
@@ -133,7 +132,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_component_off_current_analysis_globally_and_per_assignee() {
- List<String> componentUuids = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> componentUuids = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
String assignee = randomAlphanumeric(10);
componentUuids.stream()
.map(componentUuid -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setComponentUuid(componentUuid).setAssigneeUuid(assignee).setNew(false))
@@ -163,7 +162,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_ruleKey_on_current_analysis_globally_and_per_assignee() {
String repository = randomAlphanumeric(3);
- List<String> ruleKeys = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> ruleKeys = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
String assignee = randomAlphanumeric(10);
ruleKeys.stream()
.map(ruleKey -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setRuleKey(RuleKey.of(repository, ruleKey)).setAssigneeUuid(assignee).setNew(true))
@@ -179,7 +178,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_ruleKey_off_current_analysis_globally_and_per_assignee() {
String repository = randomAlphanumeric(3);
- List<String> ruleKeys = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> ruleKeys = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
String assignee = randomAlphanumeric(10);
ruleKeys.stream()
.map(ruleKey -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setRuleKey(RuleKey.of(repository, ruleKey)).setAssigneeUuid(assignee).setNew(false))
@@ -207,7 +206,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_assignee_on_current_analysis_globally_and_per_assignee() {
- List<String> assignees = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> assignees = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
assignees.stream()
.map(assignee -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(assignee).setNew(true))
.forEach(underTest::add);
@@ -235,7 +234,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_assignee_off_current_analysis_globally_and_per_assignee() {
- List<String> assignees = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> assignees = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
assignees.stream()
.map(assignee -> new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(assignee).setNew(false))
.forEach(underTest::add);
@@ -273,7 +272,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_tags_on_current_analysis_globally_and_per_assignee() {
- List<String> tags = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> tags = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
String assignee = randomAlphanumeric(10);
underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setTags(tags).setAssigneeUuid(assignee).setNew(true));
@@ -285,7 +284,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_counts_issue_per_tags_off_current_analysis_globally_and_per_assignee() {
- List<String> tags = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).collect(Collectors.toList());
+ List<String> tags = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> randomAlphabetic(3)).toList();
String assignee = randomAlphanumeric(10);
underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setTags(tags).setAssigneeUuid(assignee).setNew(false));
@@ -312,7 +311,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_sums_effort_on_current_analysis_globally_and_per_assignee() {
Random random = new Random();
- List<Integer> efforts = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> 10_000 * i).collect(Collectors.toList());
+ List<Integer> efforts = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> 10_000 * i).toList();
int expected = efforts.stream().mapToInt(s -> s).sum();
String assignee = randomAlphanumeric(10);
efforts.stream()
@@ -332,7 +331,7 @@ public class NewIssuesStatisticsTest {
@Test
public void add_sums_effort_off_current_analysis_globally_and_per_assignee() {
Random random = new Random();
- List<Integer> efforts = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> 10_000 * i).collect(Collectors.toList());
+ List<Integer> efforts = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> 10_000 * i).toList();
int expected = efforts.stream().mapToInt(s -> s).sum();
String assignee = randomAlphanumeric(10);
efforts.stream()
diff --git a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java
index 100eac83edd..062366ab244 100644
--- a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java
+++ b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java
@@ -38,7 +38,6 @@ import java.util.NoSuchElementException;
import java.util.Random;
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.reflect.ConstructorUtils;
import org.apache.http.HttpHost;
@@ -356,11 +355,11 @@ public class EsTester extends ExternalResource {
return getDocuments(indexType)
.stream()
.map(input -> (T) input.getSourceAsMap().get(fieldNameToReturn))
- .collect(Collectors.toList());
+ .toList();
}
public List<String> getIds(IndexType indexType) {
- return getDocuments(indexType).stream().map(SearchHit::getId).collect(Collectors.toList());
+ return getDocuments(indexType).stream().map(SearchHit::getId).toList();
}
public void lockWrites(IndexType index) {
diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java
index a0c3b3ef1df..34b653d9a69 100644
--- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java
+++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java
@@ -31,7 +31,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.inject.Inject;
import org.apache.commons.io.FileUtils;
import org.sonar.api.SonarRuntime;
@@ -43,10 +42,10 @@ import org.sonar.server.platform.ServerFileSystem;
import static java.lang.String.format;
import static org.apache.commons.io.FileUtils.moveFile;
-import static org.sonar.core.util.FileUtils.deleteQuietly;
-import static org.sonar.server.log.ServerProcessLogging.STARTUP_LOGGER_NAME;
import static org.sonar.core.plugin.PluginType.BUNDLED;
import static org.sonar.core.plugin.PluginType.EXTERNAL;
+import static org.sonar.core.util.FileUtils.deleteQuietly;
+import static org.sonar.server.log.ServerProcessLogging.STARTUP_LOGGER_NAME;
public class PluginJarLoader {
private static final Logger LOG = Loggers.get(PluginJarLoader.class);
@@ -179,7 +178,7 @@ public class PluginJarLoader {
List<T> list = listJarFiles(pluginsDir).stream()
.map(toPluginInfo)
.filter(this::checkPluginInfo)
- .collect(Collectors.toList());
+ .toList();
failIfContainsIncompatiblePlugins(list);
return list;
}
@@ -189,7 +188,7 @@ public class PluginJarLoader {
.filter(p -> FORBIDDEN_INCOMPATIBLE_PLUGINS.contains(p.getKey()))
.map(p -> "'" + p.getKey() + "'")
.sorted()
- .collect(Collectors.toList());
+ .toList();
if (!incompatiblePlugins.isEmpty()) {
logGenericPluginLoadErrorLog();
diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java
index 77067fa8e80..8d54c3e5f4e 100644
--- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java
+++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java
@@ -83,7 +83,7 @@ public class ServerPluginManager implements Startable {
}
private Collection<ExplodedPlugin> extractPlugins(Collection<ServerPluginInfo> plugins) {
- return plugins.stream().map(pluginJarExploder::explode).collect(Collectors.toList());
+ return plugins.stream().map(pluginJarExploder::explode).toList();
}
private static List<ServerPlugin> createServerPlugins(Collection<ExplodedPlugin> explodedPlugins, Map<String, Plugin> instancesByKey, Map<String, PluginType> typesByKey) {
diff --git a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
index 2d1dfe2ed8e..4a03dd19e76 100644
--- a/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
+++ b/server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
@@ -90,7 +90,7 @@ public class ServerPluginRepository implements PluginRepository {
.stream()
.filter(p -> p.getType() == type)
.map(ServerPlugin::getPluginInfo)
- .collect(Collectors.toList());
+ .toList();
}
@Override
@@ -104,7 +104,7 @@ public class ServerPluginRepository implements PluginRepository {
public Collection<Plugin> getPluginInstances() {
return pluginByKey.values().stream()
.map(ServerPlugin::getInstance)
- .collect(Collectors.toList());
+ .toList();
}
@Override
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/IdentityProviderRepository.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/IdentityProviderRepository.java
index c634b1783c8..e926c85d6c0 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/IdentityProviderRepository.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/IdentityProviderRepository.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.server.authentication.IdentityProvider;
@@ -53,7 +52,7 @@ public class IdentityProviderRepository {
return providersByKey.values().stream()
.filter(IS_ENABLED_FILTER)
.sorted(Comparator.comparing(TO_NAME))
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
index 4df08e2c9cc..f8f75ebd7eb 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
@@ -26,8 +26,6 @@ import org.sonar.api.resources.ResourceTypes;
import org.sonar.api.web.UserRole;
import org.sonar.db.permission.GlobalPermission;
-import static java.util.stream.Collectors.toList;
-
@Immutable
public class PermissionServiceImpl implements PermissionService {
private static final List<String> ALL_PROJECT_PERMISSIONS = List.of(
@@ -48,11 +46,11 @@ public class PermissionServiceImpl implements PermissionService {
globalPermissions = List.copyOf(ALL_GLOBAL_PERMISSIONS.stream()
.filter(s -> !s.equals(GlobalPermission.APPLICATION_CREATOR) || resourceTypes.isQualifierPresent(Qualifiers.APP))
.filter(s -> !s.equals(GlobalPermission.PORTFOLIO_CREATOR) || resourceTypes.isQualifierPresent(Qualifiers.VIEW))
- .collect(toList()));
+ .toList());
projectPermissions = List.copyOf(ALL_PROJECT_PERMISSIONS.stream()
.filter(s -> !s.equals(GlobalPermission.APPLICATION_CREATOR.getKey()) || resourceTypes.isQualifierPresent(Qualifiers.APP))
.filter(s -> !s.equals(GlobalPermission.PORTFOLIO_CREATOR.getKey()) || resourceTypes.isQualifierPresent(Qualifiers.VIEW))
- .collect(toList()));
+ .toList());
}
/**
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java
index 11b2df502b9..060e8f8341f 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java
@@ -189,7 +189,7 @@ public class ServerUserSession extends AbstractUserSession {
return projects.stream()
.filter(project -> authorizedProjectsUuids.contains(project.getUuid()))
- .collect(toList());
+ .toList();
}
private Set<String> keepProjectsUuidsByPermission(String permission, Collection<String> projectsUuids) {
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
index 88eab297ea5..920f3595997 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
@@ -22,7 +22,6 @@ package org.sonar.server.authentication;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.junit.Before;
import org.junit.Rule;
@@ -564,7 +563,7 @@ public class UserRegistrarImplTest {
}
private void checkGroupMembership(UserDto user, GroupDto... expectedGroups) {
- assertThat(db.users().selectGroupUuidsOfUser(user)).containsOnly(stream(expectedGroups).map(GroupDto::getUuid).collect(Collectors.toList()).toArray(new String[]{}));
+ assertThat(db.users().selectGroupUuidsOfUser(user)).containsOnly(stream(expectedGroups).map(GroupDto::getUuid).toList().toArray(new String[]{}));
}
private GroupDto insertDefaultGroup() {
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java
index a71cd49349e..a0a4b8f0206 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java
@@ -154,7 +154,7 @@ public class AsyncIssueIndexingImpl implements AsyncIssueIndexing {
List<String> uuids = ceQueueDtos.stream()
.filter(p -> p.getTaskType().equals(BRANCH_ISSUE_SYNC))
.map(CeQueueDto::getUuid)
- .collect(Collectors.toList());
+ .toList();
LOG.info(String.format("%s pending indexation task found to be deleted...", uuids.size()));
for (String uuid : uuids) {
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalInfoLoader.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalInfoLoader.java
index c26c2a19a08..a7cdf8713af 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalInfoLoader.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalInfoLoader.java
@@ -21,7 +21,6 @@ package org.sonar.server.platform.monitoring.cluster;
import java.util.Arrays;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.server.ServerSide;
import org.sonar.process.systeminfo.Global;
import org.sonar.process.systeminfo.SystemInfoSection;
@@ -34,12 +33,12 @@ public class GlobalInfoLoader {
public GlobalInfoLoader(SystemInfoSection[] sections) {
this.globalSections = Arrays.stream(sections)
.filter(section -> section instanceof Global)
- .collect(Collectors.toList());
+ .toList();
}
public List<ProtobufSystemInfo.Section> load() {
return globalSections.stream()
.map(SystemInfoSection::toProtobuf)
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/CommonRuleDefinitionsImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/CommonRuleDefinitionsImpl.java
index b874879c658..f2807079b77 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/CommonRuleDefinitionsImpl.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/CommonRuleDefinitionsImpl.java
@@ -22,7 +22,6 @@ package org.sonar.server.rule;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.api.rule.Severity;
@@ -67,7 +66,7 @@ public class CommonRuleDefinitionsImpl implements CommonRuleDefinitions {
private static List<Language> getActiveLanguages(Language[] allLanguages) {
return Arrays.stream(allLanguages)
.filter(Predicate.not(language -> LANGUAGES_TO_SKIP.contains(language.getKey())))
- .collect(Collectors.toList());
+ .toList();
}
private static void defineBranchCoverageRule(RulesDefinition.NewRepository repo) {
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/component/index/ComponentIndexResults.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/component/index/ComponentIndexResults.java
index 2eea7bdad58..5e4cbeff5b4 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/component/index/ComponentIndexResults.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/component/index/ComponentIndexResults.java
@@ -54,7 +54,7 @@ public class ComponentIndexResults {
}
public Builder setQualifiers(Stream<ComponentHitsPerQualifier> qualifiers) {
- this.qualifiers = qualifiers.collect(Collectors.toList());
+ this.qualifiers = qualifiers.toList();
return this;
}
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
index 73220e1072d..dc23867022a 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
@@ -219,6 +219,6 @@ public class IndexCreator implements Startable {
return Arrays.stream(client.getIndex(new GetIndexRequest("_all")).getIndices())
.filter(definedNames::contains)
.filter(index -> !DESCRIPTOR.getName().equals(index))
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
index d2f1222e2fb..0eddf3ffe48 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
@@ -1226,7 +1226,7 @@ public class IssueIndex {
.filter(categoryBucket -> StringUtils.startsWith(categoryBucket.getKeyAsString(), categoryFilter.getName() + "."))
.filter(categoryBucket -> level == null || OWASP_ASVS_40_REQUIREMENTS_BY_LEVEL.get(level).contains(categoryBucket.getKeyAsString()))
.map(categoryBucket -> processSecurityReportCategorySearchResults(categoryBucket, categoryBucket.getKeyAsString(), null, null))
- .collect(toList());
+ .toList();
return processSecurityReportCategorySearchResults(categoryFilter, categoryFilter.getName(), children, version);
}
@@ -1236,7 +1236,7 @@ public class IssueIndex {
List<SecurityStandardCategoryStatistics> children = list.stream()
.filter(categoryBucket -> OWASP_ASVS_40_REQUIREMENTS_BY_LEVEL.get(Integer.parseInt(level)).contains(categoryBucket.getKeyAsString()))
.map(categoryBucket -> processSecurityReportCategorySearchResults(categoryBucket, categoryBucket.getKeyAsString(), null, null))
- .collect(toList());
+ .toList();
return processSecurityReportCategorySearchResults(categoryFilter, categoryFilter.getName(), children, version);
}
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
index 12b092a6a00..b99603eec91 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
@@ -157,7 +157,7 @@ public class PermissionIndexer implements ProjectIndexer {
.map(indexTypeByFormat::get)
.filter(Objects::nonNull)
.map(indexType -> new BulkIndexer(esClient, indexType, Size.REGULAR, new OneToOneResilientIndexingListener(dbClient, dbSession, items)))
- .collect(Collectors.toList());
+ .toList();
if (bulkIndexers.isEmpty()) {
return result;
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexSearchTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexSearchTest.java
index 1be94127bec..79c34112ce6 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexSearchTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexSearchTest.java
@@ -21,7 +21,6 @@ package org.sonar.server.component.index;
import java.util.Arrays;
import java.util.List;
-import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.Rule;
import org.junit.Test;
@@ -105,7 +104,7 @@ public class ComponentIndexSearchTest {
public void paginate_results() {
List<ComponentDto> projects = IntStream.range(0, 9)
.mapToObj(i -> db.components().insertPrivateProject(p -> p.setName("project " + i)))
- .collect(Collectors.toList());
+ .toList();
index(projects.toArray(new ComponentDto[0]));
SearchIdResult<String> result = underTest.search(ComponentQuery.builder().build(), new SearchOptions().setPage(2, 3));
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java
index 808e066175a..84368c780c3 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java
@@ -22,7 +22,6 @@ package org.sonar.server.component.index;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
-import java.util.stream.Collectors;
import org.assertj.core.api.ListAssert;
import org.junit.Rule;
import org.sonar.api.utils.System2;
@@ -75,7 +74,7 @@ public abstract class ComponentIndexTest {
List<ComponentDto> files = Arrays.stream(resultsInOrder)
.map(r -> ComponentTesting.newFileDto(project).setName(r))
.peek(f -> f.setUuid(f.uuid() + "_" + f.name().replaceAll("[^a-zA-Z0-9]", "")))
- .collect(Collectors.toList());
+ .toList();
// index them, but not in the expected order
files.stream()
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java
index efef04bed9c..f106c9ce01c 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java
@@ -397,13 +397,13 @@ public class IssueIndexSecurityReportsTest extends IssueIndexTestCommon {
List<SecurityStandardCategoryStatistics> owaspAsvsReportGroupedByLevel = new ArrayList<>();
owaspAsvsReportGroupedByLevel.addAll(underTest.getOwaspAsvsReportGroupedByLevel(project.uuid(), false, OwaspAsvsVersion.V4_0, 1).stream()
.sorted(comparing(s -> parseInt(s.getCategory())))
- .collect(toList()));
+ .toList());
owaspAsvsReportGroupedByLevel.addAll(underTest.getOwaspAsvsReportGroupedByLevel(project.uuid(), false, OwaspAsvsVersion.V4_0, 2).stream()
.sorted(comparing(s -> parseInt(s.getCategory())))
- .collect(toList()));
+ .toList());
owaspAsvsReportGroupedByLevel.addAll(underTest.getOwaspAsvsReportGroupedByLevel(project.uuid(), false, OwaspAsvsVersion.V4_0, 3).stream()
.sorted(comparing(s -> parseInt(s.getCategory())))
- .collect(toList()));
+ .toList());
assertThat(owaspAsvsReportGroupedByLevel)
.extracting(SecurityStandardCategoryStatistics::getCategory, SecurityStandardCategoryStatistics::getVulnerabilities,
diff --git a/server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/PermissionIndexerTester.java b/server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/PermissionIndexerTester.java
index 870180f43ce..fa02817876f 100644
--- a/server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/PermissionIndexerTester.java
+++ b/server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/PermissionIndexerTester.java
@@ -27,7 +27,6 @@ import org.sonar.db.user.UserDto;
import org.sonar.server.es.EsTester;
import static java.util.Arrays.stream;
-import static java.util.stream.Collectors.toList;
public class PermissionIndexerTester {
@@ -39,7 +38,7 @@ public class PermissionIndexerTester {
}
public PermissionIndexerTester allowOnlyAnyone(ComponentDto... projects) {
- return allow(stream(projects).map(project -> new IndexPermissions(project.uuid(), project.qualifier()).allowAnyone()).collect(toList()));
+ return allow(stream(projects).map(project -> new IndexPermissions(project.uuid(), project.qualifier()).allowAnyone()).toList());
}
public PermissionIndexerTester allowOnlyUser(ComponentDto project, UserDto user) {
@@ -55,7 +54,7 @@ public class PermissionIndexerTester {
}
public PermissionIndexerTester allow(IndexPermissions... indexPermissions) {
- return allow(stream(indexPermissions).collect(toList()));
+ return allow(stream(indexPermissions).toList());
}
public PermissionIndexerTester allow(List<IndexPermissions> indexPermissions) {
diff --git a/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java b/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java
index a8040af5dde..1b872b6720a 100644
--- a/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java
+++ b/server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java
@@ -56,7 +56,7 @@ public class RecentTasksDurationTask extends ComputeEngineMetricsTask {
Collection<String> componentUuids = recentSuccessfulTasks.stream()
.map(CeActivityDto::getMainComponentUuid)
- .collect(Collectors.toList());
+ .toList();
List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids);
Map<String, String> componentUuidAndKeys = componentDtos.stream()
.collect(Collectors.toMap(ComponentDto::uuid, ComponentDto::getKey));
@@ -70,7 +70,7 @@ public class RecentTasksDurationTask extends ComputeEngineMetricsTask {
List<CeActivityDto> recentTasks = dbClient.ceActivityDao().selectNewerThan(dbSession, lastUpdatedTimestamp);
return recentTasks.stream()
.filter(c -> c.getStatus() == CeActivityDto.Status.SUCCESS)
- .collect(Collectors.toList());
+ .toList();
}
private void reportObservedDurationForTasks(List<CeActivityDto> tasks, Map<String, String> componentUuidAndKeys) {
diff --git a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/qualityprofile/QualityProfileChangeEventServiceImpl.java b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/qualityprofile/QualityProfileChangeEventServiceImpl.java
index 37ff4e45463..23fd0db37a8 100644
--- a/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/qualityprofile/QualityProfileChangeEventServiceImpl.java
+++ b/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/qualityprofile/QualityProfileChangeEventServiceImpl.java
@@ -98,14 +98,14 @@ public class QualityProfileChangeEventServiceImpl implements QualityProfileChang
try (DbSession dbSession = dbClient.openSession(false)) {
List<OrgActiveRuleDto> activeRuleDtos = dbClient.activeRuleDao().selectByProfile(dbSession, profileDto);
- List<String> activeRuleUuids = activeRuleDtos.stream().map(ActiveRuleDto::getUuid).collect(Collectors.toList());
+ List<String> activeRuleUuids = activeRuleDtos.stream().map(ActiveRuleDto::getUuid).toList();
Map<String, List<ActiveRuleParamDto>> paramsByActiveRuleUuid = dbClient.activeRuleDao().selectParamsByActiveRuleUuids(dbSession, activeRuleUuids)
.stream().collect(Collectors.groupingBy(ActiveRuleParamDto::getActiveRuleUuid));
Map<String, String> activeRuleUuidByRuleUuid = activeRuleDtos.stream().collect(Collectors.toMap(ActiveRuleDto::getRuleUuid, ActiveRuleDto::getUuid));
- List<String> ruleUuids = activeRuleDtos.stream().map(ActiveRuleDto::getRuleUuid).collect(Collectors.toList());
+ List<String> ruleUuids = activeRuleDtos.stream().map(ActiveRuleDto::getRuleUuid).toList();
List<RuleDto> ruleDtos = dbClient.ruleDao().selectByUuids(dbSession, ruleUuids);
for (RuleDto ruleDto : ruleDtos) {
@@ -124,7 +124,7 @@ public class QualityProfileChangeEventServiceImpl implements QualityProfileChang
try (DbSession dbSession = dbClient.openSession(false)) {
List<OrgActiveRuleDto> activeRuleDtos = dbClient.activeRuleDao().selectByProfile(dbSession, profileDto);
- List<String> ruleUuids = activeRuleDtos.stream().map(ActiveRuleDto::getRuleUuid).collect(Collectors.toList());
+ List<String> ruleUuids = activeRuleDtos.stream().map(ActiveRuleDto::getRuleUuid).toList();
List<RuleDto> ruleDtos = dbClient.ruleDao().selectByUuids(dbSession, ruleUuids);
for (RuleDto ruleDto : ruleDtos) {
@@ -280,7 +280,7 @@ public class QualityProfileChangeEventServiceImpl implements QualityProfileChang
.stream()
.map(profile -> getQualityProfileAssociatedProjects(dbSession, profile))
.flatMap(Collection::stream)
- .collect(Collectors.toList());
+ .toList();
}
private List<ProjectDto> getQualityProfileAssociatedProjects(DbSession dbSession, QProfileDto profile) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ListAzureProjectsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ListAzureProjectsAction.java
index abd2d87c0f2..429f9b04196 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ListAzureProjectsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ListAzureProjectsAction.java
@@ -21,8 +21,6 @@ package org.sonar.server.almintegration.ws.azure;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
-
import org.sonar.alm.client.azure.AzureDevOpsHttpClient;
import org.sonar.alm.client.azure.GsonAzureProject;
import org.sonar.alm.client.azure.GsonAzureProjectList;
@@ -99,7 +97,7 @@ public class ListAzureProjectsAction implements AlmIntegrationsWsAction {
List<AzureProject> values = projectList.getValues().stream()
.map(ListAzureProjectsAction::toAzureProject)
.sorted(comparing(AzureProject::getName, String::compareToIgnoreCase))
- .collect(Collectors.toList());
+ .toList();
ListAzureProjectsWsResponse.Builder builder = ListAzureProjectsWsResponse.newBuilder()
.addAllProjects(values);
return builder.build();
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java
index 0ea8785c9ec..b5e11fe4655 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java
@@ -134,7 +134,7 @@ public class SearchAzureReposAction implements AlmIntegrationsWsAction {
.filter(r -> isSearchOnlyByProjectName(searchQuery) || doesSearchCriteriaMatchProjectOrRepo(r, searchQuery))
.map(repo -> toAzureRepo(repo, sqProjectsKeyByAzureKey))
.sorted(comparing(AzureRepo::getName, String::compareToIgnoreCase))
- .collect(toList());
+ .toList();
LOG.debug(repositories.toString());
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketcloud/SearchBitbucketCloudReposAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketcloud/SearchBitbucketCloudReposAction.java
index b0c5def7427..e3d3eb98bcb 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketcloud/SearchBitbucketCloudReposAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketcloud/SearchBitbucketCloudReposAction.java
@@ -125,7 +125,7 @@ public class SearchBitbucketCloudReposAction implements AlmIntegrationsWsAction
List<BBCRepo> bbcRepos = repositoryList.getValues().stream()
.map(repository -> toBBCRepo(repository, workspace, sqProjectKeyByRepoSlug))
- .collect(toList());
+ .toList();
SearchBitbucketcloudReposWsResponse.Builder builder = SearchBitbucketcloudReposWsResponse.newBuilder()
.setIsLastPage(repositoryList.getNext() == null)
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/ListBitbucketServerProjectsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/ListBitbucketServerProjectsAction.java
index ae058af6921..cee13d6219a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/ListBitbucketServerProjectsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/ListBitbucketServerProjectsAction.java
@@ -21,7 +21,6 @@ package org.sonar.server.almintegration.ws.bitbucketserver;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.sonar.alm.client.bitbucketserver.BitbucketServerRestClient;
import org.sonar.alm.client.bitbucketserver.Project;
import org.sonar.alm.client.bitbucketserver.ProjectList;
@@ -93,7 +92,7 @@ public class ListBitbucketServerProjectsAction implements AlmIntegrationsWsActio
String url = requireNonNull(almSettingDto.getUrl(), "URL cannot be null");
ProjectList projectList = bitbucketServerRestClient.getProjects(url, pat);
- List<AlmProject> values = projectList.getValues().stream().map(ListBitbucketServerProjectsAction::toAlmProject).collect(Collectors.toList());
+ List<AlmProject> values = projectList.getValues().stream().map(ListBitbucketServerProjectsAction::toAlmProject).toList();
ListBitbucketserverProjectsWsResponse.Builder builder = ListBitbucketserverProjectsWsResponse.newBuilder()
.addAllProjects(values);
return builder.build();
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/SearchBitbucketServerReposAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/SearchBitbucketServerReposAction.java
index 86779141dae..5d45a796056 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/SearchBitbucketServerReposAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/SearchBitbucketServerReposAction.java
@@ -123,7 +123,7 @@ public class SearchBitbucketServerReposAction implements AlmIntegrationsWsAction
Map<String, String> sqProjectsKeyByBBSKey = getSqProjectsKeyByBBSKey(dbSession, almSettingDto, gsonBBSRepoList);
List<BBSRepo> bbsRepos = gsonBBSRepoList.getValues().stream().map(gsonBBSRepo -> toBBSRepo(gsonBBSRepo, sqProjectsKeyByBBSKey))
- .collect(toList());
+ .toList();
SearchBitbucketserverReposWsResponse.Builder builder = SearchBitbucketserverReposWsResponse.newBuilder()
.setIsLastPage(gsonBBSRepoList.isLastPage())
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/gitlab/SearchGitlabReposAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/gitlab/SearchGitlabReposAction.java
index 43d9709e0e0..fde8246eb6c 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/gitlab/SearchGitlabReposAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/gitlab/SearchGitlabReposAction.java
@@ -121,7 +121,7 @@ public class SearchGitlabReposAction implements AlmIntegrationsWsAction {
List<GitlabRepository> gitlabRepositories = gitlabProjectList.getProjects().stream()
.map(project -> toGitlabRepository(project, sqProjectsKeyByGitlabProjectId))
- .collect(toList());
+ .toList();
Paging.Builder pagingBuilder = Paging.newBuilder()
.setPageIndex(gitlabProjectList.getPageNumber())
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListAction.java
index 0458ef84e74..575c832072e 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListAction.java
@@ -21,7 +21,6 @@ package org.sonar.server.almsettings.ws;
import java.util.Comparator;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.server.ws.Change;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
@@ -109,7 +108,7 @@ public class ListAction implements AlmSettingsWsAction {
return almSettingBuilder.build();
})
- .collect(Collectors.toList());
+ .toList();
return ListWsResponse.newBuilder()
.addAllAlmSettings(wsAlmSettings).build();
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListDefinitionsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListDefinitionsAction.java
index 208aa65c933..33311c4c8ce 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListDefinitionsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListDefinitionsAction.java
@@ -82,23 +82,23 @@ public class ListDefinitionsAction implements AlmSettingsWsAction {
List<AlmSettingGithub> githubSettings = settingsByAlm.getOrDefault(ALM.GITHUB, emptyList())
.stream()
.sorted(Comparator.comparing(AlmSettingDto::getCreatedAt))
- .map(ListDefinitionsAction::toGitHub).collect(Collectors.toList());
+ .map(ListDefinitionsAction::toGitHub).toList();
List<AlmSettingAzure> azureSettings = settingsByAlm.getOrDefault(ALM.AZURE_DEVOPS, emptyList())
.stream()
.sorted(Comparator.comparing(AlmSettingDto::getCreatedAt))
- .map(ListDefinitionsAction::toAzure).collect(Collectors.toList());
+ .map(ListDefinitionsAction::toAzure).toList();
List<AlmSettingBitbucket> bitbucketSettings = settingsByAlm.getOrDefault(ALM.BITBUCKET, emptyList())
.stream()
.sorted(Comparator.comparing(AlmSettingDto::getCreatedAt))
- .map(ListDefinitionsAction::toBitbucket).collect(Collectors.toList());
+ .map(ListDefinitionsAction::toBitbucket).toList();
List<AlmSettingBitbucketCloud> bitbucketCloudSettings = settingsByAlm.getOrDefault(ALM.BITBUCKET_CLOUD, emptyList())
.stream()
.sorted(Comparator.comparing(AlmSettingDto::getCreatedAt))
- .map(ListDefinitionsAction::toBitbucketCloud).collect(Collectors.toList());
+ .map(ListDefinitionsAction::toBitbucketCloud).toList();
List<AlmSettingGitlab> gitlabSettings = settingsByAlm.getOrDefault(ALM.GITLAB, emptyList())
.stream()
.sorted(Comparator.comparing(AlmSettingDto::getCreatedAt))
- .map(ListDefinitionsAction::toGitlab).collect(Collectors.toList());
+ .map(ListDefinitionsAction::toGitlab).toList();
return ListDefinitionsWsResponse.newBuilder()
.addAllGithub(githubSettings)
.addAllAzure(azureSettings)
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
index 25bd1b3e426..ddd5a0965ee 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
@@ -118,7 +118,7 @@ public class IssuesAction implements BatchWsAction {
List<String> usersUuids = issueDtos.stream()
.filter(issue -> issue.getAssigneeUuid() != null)
.map(IssueDto::getAssigneeUuid)
- .collect(toList());
+ .toList();
Map<String, String> userLoginsByUserUuids = dbClient.userDao().selectByUuids(dbSession, usersUuids)
.stream().collect(toMap(UserDto::getUuid, UserDto::getLogin));
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java
index dabf7cb821a..2f8f202297e 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java
@@ -20,7 +20,6 @@
package org.sonar.server.ce.ws;
import java.util.List;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
@@ -137,7 +136,7 @@ public class AnalysisStatusAction implements CeWsAction {
.setMessage(dto.getMessage())
.setDismissable(dto.getType().isDismissible())
.build())
- .collect(Collectors.toList());
+ .toList();
builder.addAllWarnings(result);
return builder.build();
}
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 f4b2ef77fbf..54f941beb71 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
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.utils.DateUtils;
@@ -174,7 +173,7 @@ public class TaskFormatter {
.stream()
.collect(uniqueIndex(ComponentDto::uuid));
Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
- .selectByTaskUuids(dbSession, ceQueueDtos.stream().map(CeQueueDto::getUuid).collect(Collectors.toList()))
+ .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());
Map<String, UserDto> usersByUuid = dbClient.userDao().selectByUuids(dbSession, submitterUuids).stream().collect(uniqueIndex(UserDto::getUuid));
@@ -196,7 +195,7 @@ public class TaskFormatter {
.stream()
.collect(uniqueIndex(ComponentDto::uuid));
Multimap<String, CeTaskCharacteristicDto> characteristicsByTaskUuid = dbClient.ceTaskCharacteristicsDao()
- .selectByTaskUuids(dbSession, ceActivityDtos.stream().map(CeActivityDto::getUuid).collect(Collectors.toList()))
+ .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());
Map<String, UserDto> usersByUuid = dbClient.userDao().selectByUuids(dbSession, submitterUuids).stream().collect(uniqueIndex(UserDto::getUuid));
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchAction.java
index c5233430637..35f06d7f035 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchAction.java
@@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.resources.Qualifiers;
@@ -53,8 +52,8 @@ import static org.sonar.api.resources.Qualifiers.SUBVIEW;
import static org.sonar.api.resources.Qualifiers.VIEW;
import static org.sonar.core.util.stream.MoreCollectors.toHashSet;
import static org.sonar.server.es.SearchOptions.MAX_PAGE_SIZE;
-import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
+import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SEARCH;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_QUALIFIERS;
@@ -135,7 +134,7 @@ public class SearchAction implements ComponentsWsAction {
.selectByUuids(dbSession, projectUuidsToSearch)
.stream()
.filter(c -> !c.qualifier().equals(Qualifiers.MODULE))
- .collect(Collectors.toList());
+ .toList();
return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::getKey));
}
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 102e017936d..a3b0ee6a65b 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
@@ -264,7 +264,7 @@ public class SuggestionsAction implements ComponentsWsAction {
return stream(SuggestionCategory.values())
.map(SuggestionCategory::getQualifier)
.filter(availableQualifiers::contains)
- .collect(Collectors.toList());
+ .toList();
}
String qualifier = SuggestionCategory.getByName(more).getQualifier();
@@ -351,6 +351,6 @@ public class SuggestionsAction implements ComponentsWsAction {
.setKey(p.getKey())
.setName(p.longName())
.build())
- .collect(Collectors.toList());
+ .toList();
}
}
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 a1120098f0f..8544caaff50 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
@@ -308,7 +308,7 @@ public class SearchAction implements HotspotsWsAction {
.setDescription("Comma-separated list of SonarSource security categories. Use '" + SecurityStandards.SQCategory.OTHERS.getKey() +
"' to select issues not associated with any category")
.setSince("8.6")
- .setPossibleValues(Arrays.stream(SecurityStandards.SQCategory.values()).map(SecurityStandards.SQCategory::getKey).collect(Collectors.toList()));
+ .setPossibleValues(Arrays.stream(SecurityStandards.SQCategory.values()).map(SecurityStandards.SQCategory::getKey).toList());
action.createParam(PARAM_CWE)
.setDescription("Comma-separated list of CWE numbers")
.setExampleValue("89,434,352")
@@ -362,7 +362,7 @@ public class SearchAction implements HotspotsWsAction {
return issueKeys.stream()
.map(hotspotsByKey::get)
.filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
}
private SearchResponse doIndexSearch(WsRequest wsRequest, DbSession dbSession, @Nullable ComponentDto project) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java
index b694d5d0197..c907f1a8cad 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
-import java.util.stream.Collectors;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.protobuf.DbCommons;
@@ -63,7 +62,7 @@ public class TextRangeResponseFormatter {
convertFlowType(flow.getType()).ifPresent(targetFlow::setType);
}
return targetFlow.build();
- }).collect(Collectors.toList());
+ }).toList();
}
private static Optional<Common.FlowType> convertFlowType(DbIssues.FlowType flowType) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java
index e99eb3f4657..9b2a3795988 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java
@@ -139,7 +139,7 @@ public class AuthorsAction implements IssuesWsAction {
});
return issueIndex.searchAuthors(
issueQueryBuilder
- .types(ALL_RULE_TYPES_EXCEPT_SECURITY_HOTSPOTS.stream().map(Enum::name).collect(Collectors.toList()))
+ .types(ALL_RULE_TYPES_EXCEPT_SECURITY_HOTSPOTS.stream().map(Enum::name).toList())
.build(),
request.param(TEXT_QUERY),
request.mandatoryParamAsInt(PAGE_SIZE));
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 f93cc5734c7..6c0c69a7c77 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
@@ -384,7 +384,7 @@ public class BulkChangeAction implements IssuesWsAction {
List<IssueDto> allIssues = dbClient.issueDao().selectByKeys(dbSession, issueKeys)
.stream()
.filter(issueDto -> SECURITY_HOTSPOT.getDbConstant() != issueDto.getType())
- .collect(Collectors.toList());
+ .toList();
List<ComponentDto> allProjects = getComponents(dbSession, allIssues.stream().map(IssueDto::getProjectUuid).collect(MoreCollectors.toSet()));
this.projectsByUuid = getAuthorizedProjects(allProjects).stream().collect(uniqueIndex(ComponentDto::uuid, identity()));
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 19d7e4ab532..0fadbc7a96c 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
@@ -309,7 +309,7 @@ public class SearchAction implements IssuesWsAction {
.setDescription("Comma-separated list of SonarSource security categories. Use '" + SQCategory.OTHERS.getKey() + "' to select issues not associated" +
" with any category")
.setSince("7.8")
- .setPossibleValues(Arrays.stream(SQCategory.values()).map(SQCategory::getKey).collect(Collectors.toList()));
+ .setPossibleValues(Arrays.stream(SQCategory.values()).map(SQCategory::getKey).toList());
action.createParam(PARAM_AUTHOR)
.setDescription("SCM accounts. To set several values, the parameter must be called once for each value.")
.setExampleValue("author=torvalds@linux-foundation.org&author=linux@fondation.org");
@@ -510,7 +510,7 @@ public class SearchAction implements IssuesWsAction {
if (typeFacet != null) {
typeFacet.remove(RuleType.SECURITY_HOTSPOT.name());
}
- addMandatoryValuesToFacet(facets, PARAM_TYPES, ALL_RULE_TYPES_EXCEPT_SECURITY_HOTSPOTS.stream().map(Enum::name).collect(Collectors.toList()));
+ addMandatoryValuesToFacet(facets, PARAM_TYPES, ALL_RULE_TYPES_EXCEPT_SECURITY_HOTSPOTS.stream().map(Enum::name).toList());
}
private static void addMandatoryValuesToFacet(Facets facets, String facetName, @Nullable Iterable<String> mandatoryValues) {
@@ -617,7 +617,7 @@ public class SearchAction implements IssuesWsAction {
}
List<UserDto> userDtos = dbClient.userDao().selectByLogins(dbSession, userLogins);
- List<String> assigneeUuid = userDtos.stream().map(UserDto::getUuid).collect(toList());
+ List<String> assigneeUuid = userDtos.stream().map(UserDto::getUuid).toList();
if ((assigneeLogins != null) && firstNonNull(assigneeUuid, emptyList()).isEmpty()) {
assigneeUuid = List.of("non-existent-uuid");
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
index 4960a7d5103..e22262d6428 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
@@ -70,7 +70,6 @@ import static java.lang.String.format;
import static java.util.Collections.emptyList;
import static java.util.Objects.requireNonNull;
import static java.util.Optional.ofNullable;
-import static java.util.stream.Collectors.toList;
import static org.sonar.api.resources.Qualifiers.UNIT_TEST_FILE;
import static org.sonar.api.rule.RuleKey.EXTERNAL_RULE_REPO_PREFIX;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
@@ -148,7 +147,7 @@ public class SearchResponseFormat {
private List<Issues.Issue> createIssues(Collection<SearchAdditionalField> fields, SearchResponseData data) {
return data.getIssues().stream()
.map(dto -> createIssue(fields, data, dto))
- .collect(toList());
+ .toList();
}
private Issue createIssue(Collection<SearchAdditionalField> fields, SearchResponseData data, IssueDto dto) {
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 dbd4f1c6330..f5e31b40bcf 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
@@ -118,7 +118,7 @@ public class SearchResponseLoader {
if (issueKeysToLoad.isEmpty()) {
return issueKeys.stream()
.map(new KeyToIssueFunction(preloadedIssues)).filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
}
List<IssueDto> loadedIssues = dbClient.issueDao().selectByKeys(dbSession, issueKeysToLoad);
@@ -127,7 +127,7 @@ public class SearchResponseLoader {
return issueKeys.stream()
.map(new KeyToIssueFunction(unorderedIssues)).filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
}
private void loadUsers(SearchResponseData preloadedResponseData, Collector collector, DbSession dbSession, SearchResponseData result) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/pull/PullActionIssuesRetriever.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/pull/PullActionIssuesRetriever.java
index e2811f01c21..646934a4ede 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/pull/PullActionIssuesRetriever.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/pull/PullActionIssuesRetriever.java
@@ -29,7 +29,6 @@ import org.sonar.db.DbSession;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.issue.IssueQueryParams;
-import static java.util.stream.Collectors.toList;
import static org.sonar.db.issue.IssueDao.DEFAULT_PAGE_SIZE;
public class PullActionIssuesRetriever {
@@ -62,7 +61,7 @@ public class PullActionIssuesRetriever {
return issues
.stream()
.filter(i -> hasCorrectTypeAndStatus(i, issueQueryParams))
- .collect(toList());
+ .toList();
}
private static boolean hasCorrectTypeAndStatus(IssueDto issueDto, IssueQueryParams queryParams) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/ComponentIndexImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/ComponentIndexImpl.java
index b47f35d90d4..6d62cf65a33 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/ComponentIndexImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/ComponentIndexImpl.java
@@ -27,7 +27,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.stream.Collectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
@@ -79,7 +78,7 @@ public class ComponentIndexImpl implements ComponentIndex {
}
return dbClient.componentDao().selectByUuids(dbSession, componentUuids).stream()
.sorted(Comparator.comparing(ComponentDto::getUuidPath).reversed())
- .collect(Collectors.toList());
+ .toList();
}
@Override
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureTreeUpdaterImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureTreeUpdaterImpl.java
index 0524d13bb3a..887e402a089 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureTreeUpdaterImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureTreeUpdaterImpl.java
@@ -22,7 +22,6 @@ package org.sonar.server.measure.live;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.sonar.api.config.Configuration;
import org.sonar.api.measures.Metric;
import org.sonar.db.DbClient;
@@ -147,7 +146,7 @@ public class LiveMeasureTreeUpdaterImpl implements LiveMeasureTreeUpdater {
.flatMap(c -> matrix.getMeasure(c, currentFormula.getMetric().getKey()).stream())
.map(LiveMeasureDto::getValue)
.filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
}
/**
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/PrMeasureFix.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/PrMeasureFix.java
index 91e58e12734..7e755478ae8 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/PrMeasureFix.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/PrMeasureFix.java
@@ -129,7 +129,7 @@ class PrMeasureFix {
}
}
- List<MetricDto> toRemove = measuresByComponentUuidAndMetric.columnKeySet().stream().filter(m -> !requestedMetricKeys.contains(m.getKey())).collect(Collectors.toList());
+ List<MetricDto> toRemove = measuresByComponentUuidAndMetric.columnKeySet().stream().filter(m -> !requestedMetricKeys.contains(m.getKey())).toList();
measuresByComponentUuidAndMetric.columnKeySet().removeAll(toRemove);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/UsersAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/UsersAction.java
index 1bdd0d61e27..12ba2fab6eb 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/UsersAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/UsersAction.java
@@ -24,7 +24,6 @@ import com.google.common.collect.Ordering;
import com.google.common.collect.TreeMultimap;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.server.ws.Change;
import org.sonar.api.server.ws.Request;
@@ -174,7 +173,7 @@ public class UsersAction implements PermissionsWsAction {
if (users.isEmpty()) {
return emptyList();
}
- List<String> userUuids = users.stream().map(UserDto::getUuid).collect(Collectors.toList());
+ List<String> userUuids = users.stream().map(UserDto::getUuid).toList();
PermissionQuery.Builder queryBuilder = PermissionQuery.builder()
.withAtLeastOnePermission();
if (project != null) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java
index f09fa1f6c4c..45c46bda73a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java
@@ -23,7 +23,6 @@ import com.google.common.collect.Table;
import com.google.common.collect.TreeBasedTable;
import java.util.List;
import java.util.Locale;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.resources.Qualifiers;
@@ -177,7 +176,7 @@ public class SearchTemplatesAction implements PermissionsWsAction {
private SearchTemplatesData load(DbSession dbSession, SearchTemplatesRequest request) {
SearchTemplatesData.Builder data = builder();
List<PermissionTemplateDto> templates = searchTemplates(dbSession, request);
- List<String> templateUuids = templates.stream().map(PermissionTemplateDto::getUuid).collect(Collectors.toList());
+ List<String> templateUuids = templates.stream().map(PermissionTemplateDto::getUuid).toList();
ResolvedDefaultTemplates resolvedDefaultTemplates = defaultTemplatesResolver.resolve(dbSession);
data.templates(templates)
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
index 109d8fdf37c..d675ed0692c 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
@@ -23,7 +23,6 @@ import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import com.google.common.collect.TreeMultimap;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.security.DefaultGroups;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
@@ -151,7 +150,7 @@ public class TemplateGroupsAction implements PermissionsWsAction {
}
private List<PermissionTemplateGroupDto> findGroupPermissions(DbSession dbSession, List<GroupDto> groups, PermissionTemplateDto template) {
- List<String> names = groups.stream().map(GroupDto::getName).collect(Collectors.toList());
+ List<String> names = groups.stream().map(GroupDto::getName).toList();
return dbClient.permissionTemplateDao().selectGroupPermissionsByTemplateIdAndGroupNames(dbSession, template.getUuid(), names);
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java
index aa839c82a50..940d2bae275 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java
@@ -23,7 +23,6 @@ import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import com.google.common.collect.TreeMultimap;
import java.util.List;
-import java.util.stream.Collectors;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
@@ -110,7 +109,7 @@ public class TemplateUsersAction implements PermissionsWsAction {
Paging paging = Paging.forPageIndex(wsRequest.mandatoryParamAsInt(PAGE)).withPageSize(wsRequest.mandatoryParamAsInt(PAGE_SIZE)).andTotal(total);
List<UserDto> users = findUsers(dbSession, query, template);
List<PermissionTemplateUserDto> permissionTemplateUsers = dbClient.permissionTemplateDao().selectUserPermissionsByTemplateIdAndUserLogins(dbSession, template.getUuid(),
- users.stream().map(UserDto::getLogin).collect(Collectors.toList()));
+ users.stream().map(UserDto::getLogin).toList());
Permissions.UsersWsResponse templateUsersResponse = buildResponse(users, permissionTemplateUsers, paging);
writeProtobuf(templateUsersResponse, wsRequest, wsResponse);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
index e8c1e2dc6d1..7117602c74b 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
@@ -110,7 +109,7 @@ public class AvailableAction implements PluginsWsAction {
ofNullable(plugin.getIssueTrackerUrl()).ifPresent(builder::setIssueTrackerUrl);
ofNullable(plugin.getHomepageUrl()).ifPresent(builder::setHomepageUrl);
return builder.build();
- }).collect(Collectors.toList());
+ }).toList();
}
private static Update buildUpdate(PluginUpdate pluginUpdate) {
@@ -121,7 +120,7 @@ public class AvailableAction implements PluginsWsAction {
}
private static Collection<PluginUpdate> retrieveAvailablePlugins(UpdateCenter updateCenter) {
- return updateCenter.findAvailablePlugins().stream().sorted(NAME_KEY_PLUGIN_UPDATE_ORDERING).collect(Collectors.toList());
+ return updateCenter.findAvailablePlugins().stream().sorted(NAME_KEY_PLUGIN_UPDATE_ORDERING).toList();
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PendingAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PendingAction.java
index 8de2eb98730..0dfa202de96 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PendingAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PendingAction.java
@@ -117,6 +117,6 @@ public class PendingAction implements PluginsWsAction {
Plugin plugin = compatiblePluginsByKey.get(pluginInfo.getKey());
return buildPluginDetails(null, pluginInfo, null, plugin);
})
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
index d347cf5aeac..6f9ce1950dc 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.core.platform.PluginInfo;
import org.sonar.db.plugin.PluginDto;
@@ -120,7 +119,7 @@ public class PluginWSCommons {
ofNullable(artifact.getDescription()).ifPresent(builder::setDescription);
return builder.build();
})
- .collect(Collectors.toList());
+ .toList();
}
static UpdateStatus convertUpdateCenterStatus(PluginUpdate.Status status) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdatesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdatesAction.java
index 2a1e65350b0..e72c3752619 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdatesAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdatesAction.java
@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
@@ -122,7 +121,7 @@ public class UpdatesAction implements PluginsWsAction {
ofNullable(plugin.getIssueTrackerUrl()).ifPresent(builder::setIssueTrackerUrl);
ofNullable(plugin.getHomepageUrl()).ifPresent(builder::setHomepageUrl);
return builder.build();
- }).collect(Collectors.toList());
+ }).toList();
}
private static Collection<AvailableUpdate> buildUpdates(PluginUpdateAggregate pluginUpdateAggregate) {
@@ -132,7 +131,7 @@ public class UpdatesAction implements PluginsWsAction {
.setStatus(convertUpdateCenterStatus(pluginUpdate.getStatus()))
.addAllRequires(buildRequires(pluginUpdate))
.build())
- .collect(Collectors.toList());
+ .toList();
}
private Collection<PluginUpdateAggregate> retrieveUpdatablePlugins(UpdateCenter updateCenter) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/ProjectFinder.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/ProjectFinder.java
index 2a1d68b210d..35d1bb3f267 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/ProjectFinder.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/ProjectFinder.java
@@ -36,7 +36,6 @@ import static java.util.Comparator.comparing;
import static java.util.Comparator.nullsFirst;
import static java.util.Locale.ENGLISH;
import static java.util.Objects.requireNonNull;
-import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
@ServerSide
@@ -63,7 +62,7 @@ public class ProjectFinder {
List<Project> resultProjects = allProjects.stream()
.sorted(comparing(ProjectDto::getName, nullsFirst(String.CASE_INSENSITIVE_ORDER)))
.map(p -> new Project(p.getKey(), p.getName()))
- .collect(toList());
+ .toList();
return new SearchResult(resultProjects);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
index 67506cef44d..3caa2195cb6 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
@@ -22,7 +22,6 @@ package org.sonar.server.projectanalysis.ws;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
-import java.util.stream.Collectors;
import org.sonar.api.resources.Qualifiers;
import org.sonar.api.resources.Scopes;
import org.sonar.api.server.ws.Change;
@@ -180,7 +179,7 @@ public class SearchAction implements ProjectAnalysesWsAction {
var detectedCIs = dbClient.analysisPropertiesDao().selectByKeyAndAnalysisUuids(data.getDbSession(),
CorePropertyDefinitions.SONAR_ANALYSIS_DETECTEDCI,
- snapshotDtos.stream().map(SnapshotDto::getUuid).collect(Collectors.toList()));
+ snapshotDtos.stream().map(SnapshotDto::getUuid).toList());
data.setAnalyses(snapshotDtos);
data.setDetectedCIs(detectedCIs);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java
index 4522b5c274c..66c5c97bc1a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java
@@ -144,7 +144,7 @@ class SearchResponseBuilder {
wsQualityGate.addAllFailing(eventComponentChangeDtos.stream()
.map(SearchResponseBuilder::toFailing)
- .collect(toList()));
+ .toList());
wsEvent.setQualityGate(wsQualityGate.build());
}
@@ -163,7 +163,7 @@ class SearchResponseBuilder {
componentChangeByKey.asMap().values().stream()
.map(SearchResponseBuilder::addChange)
.map(Project::toProject)
- .collect(toList())
+ .toList()
);
wsEvent.setDefinitionChange(wsDefinitionChange.build());
} catch (IllegalStateException e) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java
index c152a7d17bd..719d225f969 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java
@@ -100,7 +100,7 @@ public class SearchAction implements ProjectLinksWsAction {
return SearchWsResponse.newBuilder()
.addAllLinks(links.stream()
.map(SearchAction::buildLink)
- .collect(Collectors.toList()))
+ .toList())
.build();
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
index fcc2235c5d7..0b6ee2b475e 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
@@ -75,7 +75,7 @@ public class QualityGateConditionsUpdater {
ValueType.RATING,
ValueType.WORK_DUR);
- private static final List<String> RATING_VALID_INT_VALUES = stream(Rating.values()).map(r -> Integer.toString(r.getIndex())).collect(Collectors.toList());
+ private static final List<String> RATING_VALID_INT_VALUES = stream(Rating.values()).map(r -> Integer.toString(r.getIndex())).toList();
private final DbClient dbClient;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java
index 9b5903daa34..19dd5487ba3 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java
@@ -38,7 +38,6 @@ import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Qualitygates;
import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.stream.Collectors.toList;
import static org.sonar.api.server.ws.WebService.Param.SELECTED;
import static org.sonar.api.utils.Paging.forPageIndex;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
@@ -156,7 +155,7 @@ public class SearchAction implements QualityGatesWsAction {
}
private static List<ProjectQgateAssociationDto> getPaginatedProjects(List<ProjectQgateAssociationDto> projects, Paging paging) {
- return projects.stream().skip(paging.offset()).limit(paging.pageSize()).collect(toList());
+ return projects.stream().skip(paging.offset()).limit(paging.pageSize()).toList();
}
private List<ProjectQgateAssociationDto> keepAuthorizedProjects(DbSession dbSession, List<ProjectQgateAssociationDto> projects) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java
index f8162c14ad6..06379246b97 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java
@@ -187,7 +187,7 @@ public class QProfileBackuperImpl implements QProfileBackuper {
private static void checkIfRulesFromExternalEngines(Collection<RuleDto> ruleDefinitions) {
List<RuleDto> externalRules = ruleDefinitions.stream()
.filter(RuleDto::isExternal)
- .collect(Collectors.toList());
+ .toList();
if (!externalRules.isEmpty()) {
throw new IllegalArgumentException("The quality profile cannot be restored as it contains rules from external rule engines: "
@@ -199,7 +199,7 @@ public class QProfileBackuperImpl implements QProfileBackuper {
List<NewCustomRule> customRulesToCreate = rules.stream()
.filter(r -> ruleDefinitionsByKey.get(r.getRuleKey()) == null && r.isCustomRule())
.map(QProfileBackuperImpl::importedRuleToNewCustomRule)
- .collect(Collectors.toList());
+ .toList();
if (!customRulesToCreate.isEmpty()) {
return db.ruleDao().selectByKeys(dbSession, ruleCreator.create(dbSession, customRulesToCreate))
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileTreeImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileTreeImpl.java
index eb269430314..0f4adba5154 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileTreeImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileTreeImpl.java
@@ -22,7 +22,6 @@ package org.sonar.server.qualityprofile;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.utils.System2;
import org.sonar.core.util.stream.MoreCollectors;
@@ -113,7 +112,7 @@ public class QProfileTreeImpl implements QProfileTree {
return rulesCollection1.stream()
.filter(rule -> !rulesCollection2Uuids.contains(rule.getRuleUuid()))
- .collect(Collectors.toList());
+ .toList();
}
private List<ActiveRuleChange> removeParent(DbSession dbSession, QProfileDto profile) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileInsertImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileInsertImpl.java
index 82f9c27d338..d6db7bf4ec5 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileInsertImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileInsertImpl.java
@@ -157,7 +157,7 @@ public class BuiltInQProfileInsertImpl implements BuiltInQProfileInsert {
List<ActiveRuleParamDto> rules = ruleRepository.getRuleParams(activeRule.getRuleKey()).stream()
.map(param -> createParamDto(param, Optional.ofNullable(valuesByParamKey.get(param.getName())).orElse(param.getDefaultValue())))
.filter(Objects::nonNull)
- .collect(Collectors.toList());
+ .toList();
rules.forEach(paramDto -> dbClient.activeRuleDao().insertParam(session, activeRuleDto, paramDto));
return rules;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivationContext.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivationContext.java
index 3f209ca7172..ab1040443ec 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivationContext.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivationContext.java
@@ -186,7 +186,7 @@ public class RuleActivationContext {
loadDescendants();
return getProfiles().stream()
.flatMap(p -> profilesByParentUuid.get(p.getKee()).stream())
- .collect(Collectors.toList());
+ .toList();
}
private void loadDescendants() {
@@ -228,7 +228,7 @@ public class RuleActivationContext {
this.currentRulesProfile = ruleProfile;
this.currentProfiles = profilesByUuid.values().stream()
.filter(p -> p.getRulesProfileUuid().equals(ruleProfile.getUuid()))
- .collect(Collectors.toList());
+ .toList();
this.currentActiveRule = this.activeRulesByKey.get(ActiveRuleKey.of(ruleProfile, ruleKey));
this.currentParentActiveRule = this.currentProfiles.stream()
.map(QProfileDto::getParentKee)
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivator.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivator.java
index 7529e686640..568efa6db82 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivator.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivator.java
@@ -55,7 +55,6 @@ import org.sonar.server.user.UserSession;
import org.sonar.server.util.TypeValidations;
import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.stream.Collectors.toList;
import static org.sonar.server.exceptions.BadRequestException.checkRequest;
/**
@@ -80,7 +79,7 @@ public class RuleActivator {
public List<ActiveRuleChange> activate(DbSession dbSession, Collection<RuleActivation> activations, RuleActivationContext context) {
return activations.stream().map(a -> activate(dbSession, a, context))
.flatMap(List::stream)
- .collect(toList());
+ .toList();
}
public List<ActiveRuleChange> activate(DbSession dbSession, RuleActivation activation, RuleActivationContext context) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java
index 9da8e3244f8..a6340a13eb4 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java
@@ -22,7 +22,6 @@ package org.sonar.server.qualityprofile.ws;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
@@ -116,13 +115,13 @@ public class InheritanceAction implements QProfileWsAction {
private static Iterable<QualityProfile> buildAncestors(List<QProfileDto> ancestors, Statistics statistics) {
return ancestors.stream()
.map(ancestor -> buildProfile(ancestor, statistics))
- .collect(Collectors.toList());
+ .toList();
}
private static Iterable<QualityProfile> buildChildren(List<QProfileDto> children, Statistics statistics) {
return children.stream()
.map(child -> buildProfile(child, statistics))
- .collect(Collectors.toList());
+ .toList();
}
private static QualityProfile buildProfile(QProfileDto qualityProfile, Statistics statistics) {
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 30c259a24cb..b711fba6112 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
@@ -194,7 +194,7 @@ public class SearchAction implements QProfileWsAction {
.filter(byDefault(request, defaultProfiles))
.filter(byProject(dbSession, project, defaultProfiles))
.sorted(Q_PROFILE_COMPARATOR)
- .collect(Collectors.toList());
+ .toList();
}
private Predicate<QProfileDto> hasLanguagePlugin() {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleCreator.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleCreator.java
index f9d102a8818..cb115044593 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleCreator.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleCreator.java
@@ -109,7 +109,7 @@ public class RuleCreator {
RuleKey customRuleKey = RuleKey.of(templateRule.getRepositoryKey(), newCustomRule.ruleKey());
return createCustomRule(customRuleKey, newCustomRule, templateRule, dbSession);
})
- .collect(Collectors.toList());
+ .toList();
ruleIndexer.commitAndIndex(dbSession, customRuleUuids);
return newRules.stream()
@@ -117,7 +117,7 @@ public class RuleCreator {
RuleDto templateRule = templateRules.get(newCustomRule.templateKey());
return RuleKey.of(templateRule.getRepositoryKey(), newCustomRule.ruleKey());
})
- .collect(Collectors.toList());
+ .toList();
}
private void validateCustomRule(NewCustomRule newRule, DbSession dbSession, RuleKey templateKey) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java
index b1096c5fcbb..00c4f510b5f 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java
@@ -145,7 +145,7 @@ public class ActiveRuleCompleter {
activeRuleUuidsByKey.put(activeRuleDto.getUuid(), activeRuleDto.getKey());
}
- List<String> activeRuleUuids = activeRules.stream().map(ActiveRuleDto::getUuid).collect(Collectors.toList());
+ List<String> activeRuleUuids = activeRules.stream().map(ActiveRuleDto::getUuid).toList();
List<ActiveRuleParamDto> activeRuleParams = dbClient.activeRuleDao().selectParamsByActiveRuleUuids(dbSession, activeRuleUuids);
ListMultimap<ActiveRuleKey, ActiveRuleParamDto> activeRuleParamsByActiveRuleKey = ArrayListMultimap.create(activeRules.size(), 10);
for (ActiveRuleParamDto activeRuleParamDto : activeRuleParams) {
@@ -155,7 +155,7 @@ public class ActiveRuleCompleter {
return activeRules.stream()
.map(activeRule -> buildActiveRuleResponse(activeRule, activeRuleParamsByActiveRuleKey.get(activeRule.getKey())))
- .collect(Collectors.toList());
+ .toList();
}
private static Rules.Active buildActiveRuleResponse(OrgActiveRuleDto activeRule, List<ActiveRuleParamDto> parameters) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/CreateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/CreateAction.java
index 66744b86d64..654a508fcc3 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/CreateAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/CreateAction.java
@@ -25,7 +25,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.RuleStatus;
import org.sonar.api.rule.Severity;
@@ -130,7 +129,7 @@ public class CreateAction implements RulesWsAction {
.setPossibleValues(
Arrays.stream(RuleStatus.values())
.filter(status -> !RuleStatus.REMOVED.equals(status))
- .collect(Collectors.toList()))
+ .toList())
.setDefaultValue(RuleStatus.READY)
.setDescription("Rule status");
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java
index 386adfdfe4d..efba2d80213 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java
@@ -215,7 +215,7 @@ public class RuleMapper {
List<String> deprecatedKeys = deprecatedRuleKeyDtos.stream()
.map(r -> RuleKey.of(r.getOldRepositoryKey(), r.getOldRuleKey()).toString())
- .collect(Collectors.toList());
+ .toList();
if (!deprecatedKeys.isEmpty()) {
ruleResponse.setDeprecatedKeys(Rules.DeprecatedKeys.newBuilder().addAllDeprecatedKey(deprecatedKeys).build());
}
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 221caa4eafc..69fd7d929d1 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,7 +24,6 @@ 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;
@@ -140,7 +139,7 @@ public class RuleWsSupport {
.setDescription("Comma-separated list of SonarSource security categories. Use '" + SQCategory.OTHERS.getKey() + "' to select rules not associated" +
" with any category")
.setSince("7.8")
- .setPossibleValues(Arrays.stream(SQCategory.values()).map(SQCategory::getKey).collect(Collectors.toList()))
+ .setPossibleValues(Arrays.stream(SQCategory.values()).map(SQCategory::getKey).toList())
.setExampleValue("sql-injection,command-injection,others");
action
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SetAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SetAction.java
index 6288d8fe2ba..a5ce4c1cc06 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SetAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SetAction.java
@@ -221,12 +221,12 @@ public class SetAction implements SettingsWsAction {
List<Map<String, String>> maps = request.getFieldValues().stream()
.map(oneFieldValues -> readOneFieldValues(oneFieldValues, request.getKey()))
- .collect(Collectors.toList());
+ .toList();
for (Map<String, String> map : maps) {
checkRequest(map.values().stream().anyMatch(StringUtils::isNotBlank), MSG_NO_EMPTY_VALUE);
}
- List<Map.Entry<String, String>> entries = maps.stream().flatMap(map -> map.entrySet().stream()).collect(Collectors.toList());
+ List<Map.Entry<String, String>> entries = maps.stream().flatMap(map -> map.entrySet().stream()).toList();
entries.forEach(entry -> valuesByFieldKeys.put(entry.getKey(), entry.getValue()));
entries.forEach(entry -> checkRequest(fieldKeys.contains(entry.getKey()), "Unknown field key '%s' for setting '%s'", entry.getKey(), request.getKey()));
checkFieldType(request, definition, valuesByFieldKeys);
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SettingValidations.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SettingValidations.java
index 660bd9e12e1..082b73bf7d1 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SettingValidations.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SettingValidations.java
@@ -158,7 +158,7 @@ public class SettingValidations {
private void validateMetric(SettingData data) {
try (DbSession dbSession = dbClient.openSession(false)) {
- List<MetricDto> metrics = dbClient.metricDao().selectByKeys(dbSession, data.values).stream().filter(MetricDto::isEnabled).collect(Collectors.toList());
+ List<MetricDto> metrics = dbClient.metricDao().selectByKeys(dbSession, data.values).stream().filter(MetricDto::isEnabled).toList();
checkRequest(data.values.size() == metrics.size(), "Error when validating metric setting with key '%s' and values [%s]. A value is not a valid metric key.",
data.key, data.values.stream().collect(Collectors.joining(", ")));
}
@@ -166,7 +166,7 @@ public class SettingValidations {
private void validateLogin(SettingData data) {
try (DbSession dbSession = dbClient.openSession(false)) {
- List<UserDto> users = dbClient.userDao().selectByLogins(dbSession, data.values).stream().filter(UserDto::isActive).collect(Collectors.toList());
+ List<UserDto> users = dbClient.userDao().selectByLogins(dbSession, data.values).stream().filter(UserDto::isActive).toList();
checkRequest(data.values.size() == users.size(), "Error when validating login setting with key '%s' and values [%s]. A value is not a valid login.",
data.key, data.values.stream().collect(Collectors.joining(", ")));
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ValuesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
index 0c364dc3b90..a4e9a526d31 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
@@ -174,7 +174,7 @@ public class ValuesAction implements SettingsWsAction {
component.ifPresent(componentDto -> settings.addAll(loadComponentSettings(dbSession, keys, componentDto).values()));
return settings.stream()
.filter(s -> settingsWsSupport.isVisible(s.getKey(), component))
- .collect(Collectors.toList());
+ .toList();
}
@CheckForNull
@@ -190,7 +190,7 @@ public class ValuesAction implements SettingsWsAction {
.filter(definition -> keys.contains(definition.key()))
.filter(defaultProperty -> !isEmpty(defaultProperty.defaultValue()))
.map(Setting::createFromDefinition)
- .collect(Collectors.toList());
+ .toList();
}
private Map<String, String> getKeysToDisplayMap(Set<String> keys) {
@@ -206,7 +206,7 @@ public class ValuesAction implements SettingsWsAction {
List<PropertyDto> propertySets = dbClient.propertiesDao().selectGlobalPropertiesByKeys(dbSession, getPropertySetKeys(properties));
return properties.stream()
.map(property -> Setting.createFromDto(property, getPropertySets(property.getKey(), propertySets, null), propertyDefinitions.get(property.getKey())))
- .collect(Collectors.toList());
+ .toList();
}
/**
@@ -239,7 +239,7 @@ public class ValuesAction implements SettingsWsAction {
return propertySets.stream()
.filter(propertyDto -> Objects.equals(propertyDto.getComponentUuid(), componentUuid))
.filter(propertyDto -> propertyDto.getKey().startsWith(propertyKey + "."))
- .collect(Collectors.toList());
+ .toList();
}
private class ValuesResponseBuilder {
@@ -331,7 +331,7 @@ public class ValuesAction implements SettingsWsAction {
}
private Settings.Values.Builder createValuesBuilder(String value) {
- List<String> values = COMMA_SPLITTER.splitToList(value).stream().map(v -> v.replace(COMMA_ENCODED_VALUE, ",")).collect(Collectors.toList());
+ List<String> values = COMMA_SPLITTER.splitToList(value).stream().map(v -> v.replace(COMMA_ENCODED_VALUE, ",")).toList();
return Settings.Values.newBuilder().addAllValues(values);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/WebAnalyticsLoaderImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/WebAnalyticsLoaderImpl.java
index 05dc60e4020..f4409758de2 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/WebAnalyticsLoaderImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/WebAnalyticsLoaderImpl.java
@@ -22,7 +22,6 @@ package org.sonar.server.ui;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.api.utils.MessageException;
import org.sonar.api.web.WebAnalytics;
@@ -37,7 +36,7 @@ public class WebAnalyticsLoaderImpl implements WebAnalyticsLoader {
this.analytics = null;
} else {
if (analytics.length > 1) {
- List<String> classes = Arrays.stream(analytics).map(a -> a.getClass().getName()).collect(Collectors.toList());
+ List<String> classes = Arrays.stream(analytics).map(a -> a.getClass().getName()).toList();
throw MessageException.of("Limited to only one web analytics plugin. Found multiple implementations: " + classes);
}
this.analytics = analytics.length == 1 ? analytics[0] : null;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/ComponentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
index d3b7a0dd4f0..8c8de6fcf66 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.config.Configuration;
@@ -259,7 +258,7 @@ public class ComponentAction implements NavigationWsAction {
.map(LiveMeasureDto::getDataAsString)
.map(data -> QPMeasureData.fromJson(data).getProfiles())
.orElse(emptySortedSet());
- Map<String, QProfileDto> dtoByQPKey = dbClient.qualityProfileDao().selectByUuids(dbSession, qualityProfiles.stream().map(QualityProfile::getQpKey).collect(Collectors.toList()))
+ Map<String, QProfileDto> dtoByQPKey = dbClient.qualityProfileDao().selectByUuids(dbSession, qualityProfiles.stream().map(QualityProfile::getQpKey).toList())
.stream()
.collect(uniqueIndex(QProfileDto::getKee));
json.name("qualityProfiles").beginArray();
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
index 17dfe192cb9..78ed24a9357 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
@@ -47,7 +47,6 @@ import static java.util.Collections.singletonList;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static java.util.Optional.ofNullable;
-import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang.StringUtils.EMPTY;
import static org.sonar.api.web.UserRole.USER;
import static org.sonar.server.user.ws.DismissNoticeAction.EDUCATION_PRINCIPLES;
@@ -138,7 +137,7 @@ public class CurrentAction implements UsersWsAction {
return permissionService.getGlobalPermissions().stream()
.filter(userSession::hasPermission)
.map(GlobalPermission::getKey)
- .collect(toList());
+ .toList();
}
private boolean isNoticeDismissed(UserDto user, String noticeName) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/HomepageTypesImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/HomepageTypesImpl.java
index 3bc020a973d..cd0558ef0dd 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/HomepageTypesImpl.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/HomepageTypesImpl.java
@@ -31,7 +31,7 @@ public class HomepageTypesImpl implements HomepageTypes {
private List<Type> types;
public HomepageTypesImpl() {
- types = Stream.of(HomepageTypes.Type.values()).collect(Collectors.toList());
+ types = Stream.of(HomepageTypes.Type.values()).toList();
}
@Override
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateIdentityProviderAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateIdentityProviderAction.java
index bd11714f992..b9034d38722 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateIdentityProviderAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateIdentityProviderAction.java
@@ -126,7 +126,7 @@ public class UpdateIdentityProviderAction implements UsersWsAction {
return identityProviderRepository.getAllEnabledAndSorted()
.stream()
.map(IdentityProvider::getKey)
- .collect(Collectors.toList());
+ .toList();
}
private static boolean isLdapIdentityProvider(String identityProviderKey) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/NetworkInterfaceProvider.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/NetworkInterfaceProvider.java
index 0eac1b08f6a..247977052f1 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/NetworkInterfaceProvider.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/NetworkInterfaceProvider.java
@@ -24,7 +24,6 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.List;
-import java.util.stream.Collectors;
public class NetworkInterfaceProvider {
@@ -32,6 +31,6 @@ public class NetworkInterfaceProvider {
return Collections.list(NetworkInterface.getNetworkInterfaces())
.stream()
.flatMap(ni -> Collections.list(ni.getInetAddresses()).stream())
- .collect(Collectors.toList());
+ .toList();
}
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/almintegration/ws/bitbucketserver/ImportBitbucketServerProjectActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/almintegration/ws/bitbucketserver/ImportBitbucketServerProjectActionTest.java
index 8fac8367716..0b0789cec06 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/almintegration/ws/bitbucketserver/ImportBitbucketServerProjectActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/almintegration/ws/bitbucketserver/ImportBitbucketServerProjectActionTest.java
@@ -272,7 +272,7 @@ public class ImportBitbucketServerProjectActionTest {
Optional<ProjectDto> projectDto = db.getDbClient().projectDao().selectProjectByKey(db.getSession(), result.getKey());
Collection<BranchDto> branchDtos = db.getDbClient().branchDao().selectByProject(db.getSession(), projectDto.get());
- List<BranchDto> collect = branchDtos.stream().filter(BranchDto::isMain).collect(Collectors.toList());
+ List<BranchDto> collect = branchDtos.stream().filter(BranchDto::isMain).toList();
String mainBranchName = collect.iterator().next().getKey();
assertThat(mainBranchName).isEqualTo(DEFAULT_MAIN_BRANCH_NAME);
}
@@ -306,7 +306,7 @@ public class ImportBitbucketServerProjectActionTest {
Optional<ProjectDto> projectDto = db.getDbClient().projectDao().selectProjectByKey(db.getSession(), result.getKey());
Collection<BranchDto> branchDtos = db.getDbClient().branchDao().selectByProject(db.getSession(), projectDto.get());
- List<BranchDto> collect = branchDtos.stream().filter(BranchDto::isMain).collect(Collectors.toList());
+ List<BranchDto> collect = branchDtos.stream().filter(BranchDto::isMain).toList();
String mainBranchName = collect.iterator().next().getKey();
assertThat(mainBranchName).isEqualTo("default");
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
index d9662c6f135..7e5f3504f58 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
@@ -191,7 +191,7 @@ public class HealthCheckerImplTest {
when(nodeInformation.isStandalone()).thenReturn(false);
List<String[]> causesGroups = IntStream.range(0, 1 + random.nextInt(20))
.mapToObj(s -> IntStream.range(0, random.nextInt(3)).mapToObj(i -> randomAlphanumeric(3)).toArray(String[]::new))
- .collect(Collectors.toList());
+ .toList();
ClusterHealthCheck[] clusterHealthChecks = causesGroups.stream()
.map(HardcodedHealthClusterCheck::new)
.map(ClusterHealthCheck.class::cast)
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java
index 91cfdca5016..d562fbb8ec5 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java
@@ -967,10 +967,10 @@ public class ShowActionTest {
.build()));
List<Common.Changelog> changelog = IntStream.range(0, 1 + new Random().nextInt(12))
.mapToObj(i -> Common.Changelog.newBuilder().setUser("u" + i).build())
- .collect(Collectors.toList());
+ .toList();
List<Common.Comment> comments = IntStream.range(0, 1 + new Random().nextInt(12))
.mapToObj(i -> Common.Comment.newBuilder().setKey("u" + i).build())
- .collect(Collectors.toList());
+ .toList();
FormattingContext formattingContext = mockChangelogAndCommentsFormattingContext();
when(issueChangeSupport.formatChangelog(any(), any())).thenReturn(changelog.stream());
when(issueChangeSupport.formatComments(any(), any(), any())).thenReturn(comments.stream());
@@ -1112,7 +1112,7 @@ public class ShowActionTest {
.setUserName("Joe")
.setAvatar("my-avatar")
.build())
- .collect(Collectors.toList());
+ .toList();
List<Common.Comment> comments = IntStream.range(0, 3)
.mapToObj(i -> Common.Comment.newBuilder()
.setKey("comment-" + i)
@@ -1121,7 +1121,7 @@ public class ShowActionTest {
.setMarkdown("markdown " + i)
.setCreatedAt("2020-01-02T14:47:47+0100")
.build())
- .collect(Collectors.toList());
+ .toList();
mockChangelogAndCommentsFormattingContext();
when(issueChangeSupport.formatChangelog(any(), any())).thenReturn(changelog.stream());
diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/MessageFormattingUtils.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/MessageFormattingUtils.java
index 6710e02e1ed..689fdc39bf7 100644
--- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/MessageFormattingUtils.java
+++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/MessageFormattingUtils.java
@@ -20,7 +20,6 @@
package org.sonar.server.ws;
import java.util.List;
-import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.sonar.db.protobuf.DbIssues;
import org.sonarqube.ws.Common;
@@ -46,7 +45,7 @@ public class MessageFormattingUtils {
.setStart(f.getStart())
.setEnd(f.getEnd())
.setType(Common.MessageFormattingType.valueOf(f.getType().name())).build())
- .collect(Collectors.toList());
+ .toList();
}
}