]> source.dussan.org Git - sonarqube.git/commitdiff
[NO-JIRA] Remove reported code smells about usages of toList
authorMatteo Mara <matteo.mara@sonarsource.com>
Tue, 10 Jan 2023 14:16:50 +0000 (15:16 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 10 Jan 2023 20:03:01 +0000 (20:03 +0000)
146 files changed:
server/sonar-alm-client/src/main/java/org/sonar/alm/client/github/GithubApplicationClientImpl.java
server/sonar-auth-saml/src/main/java/org/sonar/auth/saml/SamlStatusChecker.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryWithMigration.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/VisitorsCrawler.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/IntegrateCrossProjectDuplications.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/PullRequestFileMoveDetectionStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitor.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/QualityGateDetailsData.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadMeasureComputersStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistEventsStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStep.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepoEntry.java
server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
server/sonar-ce/src/main/java/org/sonar/ce/monitoring/CeTasksMBeanImpl.java
server/sonar-ce/src/main/java/org/sonar/ce/queue/NextPendingTaskPicker.java
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java
server/sonar-db-dao/src/testFixtures/java/org/sonar/db/webhook/WebhookDeliveryTesting.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandler.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/AddPrimaryKeyBuilder.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableAsBuilder.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/RenameColumnsBuilder.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v91/MigratePortfoliosToNewTables.java
server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java
server/sonar-main/src/main/java/org/sonar/application/config/ClusterSettings.java
server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java
server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java
server/sonar-server-common/src/main/java/org/sonar/server/es/EsClientProvider.java
server/sonar-server-common/src/main/java/org/sonar/server/es/ProjectIndexers.java
server/sonar-server-common/src/main/java/org/sonar/server/es/searchrequest/RequestFiltersComputer.java
server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
server/sonar-server-common/src/main/java/org/sonar/server/issue/workflow/State.java
server/sonar-server-common/src/main/java/org/sonar/server/metric/MetricFinder.java
server/sonar-server-common/src/main/java/org/sonar/server/platform/monitoring/cluster/ProcessInfoProvider.java
server/sonar-server-common/src/main/java/org/sonar/server/qualityprofile/QPMeasureData.java
server/sonar-server-common/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java
server/sonar-server-common/src/main/java/org/sonar/server/security/SecurityStandards.java
server/sonar-server-common/src/main/java/org/sonar/server/webhook/NetworkInterfaceProvider.java
server/sonar-server-common/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java
server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/EsTester.java
server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/PluginJarLoader.java
server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java
server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/IdentityProviderRepository.java
server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/PermissionServiceImpl.java
server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java
server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
server/sonar-webserver-core/src/main/java/org/sonar/server/issue/index/AsyncIssueIndexingImpl.java
server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/cluster/GlobalInfoLoader.java
server/sonar-webserver-core/src/main/java/org/sonar/server/rule/CommonRuleDefinitionsImpl.java
server/sonar-webserver-es/src/main/java/org/sonar/server/component/index/ComponentIndexResults.java
server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexSearchTest.java
server/sonar-webserver-es/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java
server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java
server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/PermissionIndexerTester.java
server/sonar-webserver-monitoring/src/main/java/org/sonar/server/monitoring/ce/RecentTasksDurationTask.java
server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/qualityprofile/QualityProfileChangeEventServiceImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/ListAzureProjectsAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/azure/SearchAzureReposAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketcloud/SearchBitbucketCloudReposAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/ListBitbucketServerProjectsAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/bitbucketserver/SearchBitbucketServerReposAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/gitlab/SearchGitlabReposAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/almsettings/ws/ListDefinitionsAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/AnalysisStatusAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AuthorsAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseLoader.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/pull/PullActionIssuesRetriever.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/ComponentIndexImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureTreeUpdaterImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/PrMeasureFix.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/UsersAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/permission/ws/template/TemplateUsersAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PendingAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/UpdatesAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/ProjectFinder.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileBackuperImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileTreeImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/BuiltInQProfileInsertImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivationContext.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/builtin/RuleActivator.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/InheritanceAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleCreator.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/CreateAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SetAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/SettingValidations.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/WebAnalyticsLoaderImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/HomepageTypesImpl.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateIdentityProviderAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/NetworkInterfaceProvider.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/almintegration/ws/bitbucketserver/ImportBitbucketServerProjectActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/hotspot/ws/ShowActionTest.java
server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/MessageFormattingUtils.java

index 5eca820bb23421bf18553ea6fbea33a2b827bfd1..3ac26c2d00bc1cb79ffda64ef5e501a9bcf04623 100644 (file)
@@ -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;
index cf9ce133f800a7d4f7a546737df6413ee61ca722..4ed1f7967dae33451e4a929b6a4b7e93e6d5ad93 100644 (file)
@@ -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();
   }
 
 }
index e345bbda425a924209c9a271d99d5e412ebd5e0b..78301ff62c5a5af51a0e348f11951a10cfe87d40 100644 (file)
@@ -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();
index b3aeae90cef0197f82760141834c628bf923efe3..6fa5db3068daec2bcb2b69de1004ff6033a8b8b6 100644 (file)
@@ -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;
     }
index 039042216bd470a01368e365cde75fcf678cb789..25ad3067ed799579ded7c1969251e6d0dca9bcf4 100644 (file)
@@ -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) {
index 169c0fa64794bbc0173a3923fae0cd8a389e3877..14fe9cebfa1266c0ded11920dc43f4f04e047021 100644 (file)
@@ -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) {
index fa392c144a3d16c6861147d889e698c967452f4e..f1c19139fca0d22fab42a98b34e3dadce59693b8 100644 (file)
@@ -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) {
index 925b55238a633e02a7f28a64bac40c2762bf21ea..a27b2857d63b9c567e73a0089c938747705ecdaf 100644 (file)
@@ -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;
index d9d1c5bcebd479ba903b5d4a0b2f2d3d93d6aae6..c387af15a5635a4b5ad8015564594d608d0c7cbd 100644 (file)
@@ -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) {
index 2d26c60b6df68c1420595a3e470c94b62a2def11..a91c76eeecbbc168c5e4db6d89bc14068cef93c2 100644 (file)
@@ -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();
   }
 
 }
index f779010294988acfb3ff56308835fe00ce347d58..3c3b80cfefd974748e84d32cbe928734a7bd00d7 100644 (file)
@@ -60,7 +60,7 @@ public class SiblingsIssuesLoader {
       return dbClient.issueDao().selectOpenByComponentUuids(session, uuids)
         .stream()
         .map(SiblingsIssuesLoader::toSiblingIssue)
-        .collect(Collectors.toList());
+        .toList();
     }
   }
 
index 8d3cb80dd67c089a2f6cd53e41e8100ad031f311..e61c92d2037aa0d4cdb7e19a08090949269d088f 100644 (file)
@@ -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();
   }
 }
index 48820f986e7fcf0984ed686d1e01016cf65734c8..aa7d632a6b2c9182035f94dea0d6d4159b466cda 100644 (file)
@@ -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;
   }
 
index 5d826424fb7aaa7609859ee6f20b4504722b5a7e..2e17ef70a4d2672549ec4eadb82aecb1e9b391ea 100644 (file)
@@ -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() {
index fa756e58d8ca0ff4f39ee02f44c1bbddf8fbf678..299ecb6f7b4571a830d6f1bf4b93cf540e75b25a 100644 (file)
@@ -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 {
index f2b856547a0d2cf5f53e4a48eda9ad5509bac6e6..0763f91c4a5eeb7190c74a5cd97df6504d1aebca 100644 (file)
@@ -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);
index 3ddeaa3aafab93fcaef9f20a5d813aa25b5c51ae..70a83570effc8073ce0bf842dc282927d2820956 100644 (file)
@@ -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) {
index f17af1b78f899b45061859dacdbbc866991733fd..05d8501dffb246a4d649bcf0fdf881d14cd92c2f 100644 (file)
@@ -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> {
index 197e094a547231cfc8e8db8a4dc4582524e5e1b2..672fd378a1c4de7915518dd83581117c3772567c 100644 (file)
@@ -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() {
index ec1d1434b604fde58d0a81e264efbba5560b5f62..51677f0fb4f6f85e75faf76ad5982318fa39c1fd 100644 (file)
@@ -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);
       }
     }
index e0ae3f266cfd9230684bb5691b38bdba1d211a8d..35b98f14122e796626634310fad860586f1167ba 100644 (file)
@@ -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));
     }
index d136db960279808235353cd6f0434b7830d977d2..b8aeebc7cfddc82c8454381c6f055df0adffd3f6 100644 (file)
@@ -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 {
index 31817fed2c5c07d374d41b4fc8399f6750909f2a..0b4e582c5912b7d661bef507a94138fbab26cad2 100644 (file)
@@ -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())
index 35005c4457930deae6c23bfd5c6df1f588681a2e..91ee2234dc060243f68e8cbcd3648278ed818bf8 100644 (file)
@@ -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))
index 426887ee0c323922486321a37a58ce927da4e691..8d788b1c6d85b00eb928ab5b32885c71e64afee2 100644 (file)
@@ -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();
index 46c33fab7468733ff1cbb7993ba763c0b2bd3d34..306551d95ddd85be3d8fd867c614f45e2d57ac11 100644 (file)
@@ -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) {
index c7c8dbd803f8cbacd98ff7032c6de79839698583..f012aa78c16a184b38f1d8f25d431abaabb1e97b 100644 (file)
@@ -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();
   }
 }
index cac5d41570d4c9e9ab0adcca2df49ad6dbbf78cd..e8ff259765d407a8292bd0cf408439818f666bbf 100644 (file)
@@ -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
index 0a4f53ea1a038517515af9654b1ca670a2571d5b..4bd038ece4f57a83d4a43b794ef2a5d8166fa254 100644 (file)
@@ -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));
   }
index f09ae4a1191ca551154274801f3de7d143513a0f..782981eacad9b14a5a36e754b9a7166d3e462dcc 100644 (file)
@@ -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));
 
index 9a04bb540b3219f227c577c62e334aacd1b5cddd..8a332eeba65d9b06296f9f2f2922acd9672f29fc 100644 (file)
@@ -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);
index 12df2a2a179f94c81fb9d12ba1de5e51e7747b0a..22beed6aea9085d8b0244fa735ef83cff1d8b1d5 100644 (file)
@@ -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) {
index 8eb96fe9eda34cdd772258d1ad9a96f942c71f13..789584f4406ac7b09748d3b4f241c3cab820853e 100644 (file)
@@ -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);
index d62e758b6f8b38cb5dc88476b3c74b88e7f3fc27..04b691f84d2087b4679d6123bdf2f96dc37c8237 100644 (file)
@@ -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)
index c0c804091ee9b8dec481970e9da9a0428bab9c7e..6c41d79d05112081361002fd50a5b7471075f058 100644 (file)
@@ -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)
index 951733e8d82ae3d60ebf0ebc0bb7bb1284241a26..b8da7e7bc3586d4b573c5b230c40fa5c45bc3bf3 100644 (file)
@@ -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);
index 28699396ba98f0e84d233661ccf7e821ead8f15d..b48926f58a98cf37dc95b8550d8e58232493539f 100644 (file)
@@ -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();
index 8ab7e6fdd327b4465e781ae7a3393760e205d4f7..01398aec0c3897650f9d78edff838e109e3953d5 100644 (file)
@@ -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);
index c0b1cfc2a6157cc8e95b05cc075f8b5cfe81de01..ae149ffefc93435b12941bfa1b5bdf409f378fb7 100644 (file)
@@ -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();
   }
 }
index db79e606916b37b82aec87f72516b7d80154e06f..2e5ad96bb3fad59bd0415ec67ff8b2348bb18355 100644 (file)
@@ -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));
index cf60fdbee1edac3cf40e1679ae15646d31f0142e..6e66dc03708dbeaabb0b3a932ceab26573f0c384 100644 (file)
@@ -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() {
index 7343fc5a9796b271f87168ab5e5eabd9d3d9fca5..2b9b3561fca35d28a0f219ba239863a85f84f422 100644 (file)
@@ -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());
     }
index 796e22819137a7103a07d7097f9949efedbe1c57..320241f0c7927bfaa3c02d46a0baf4c3c6ecaa42 100644 (file)
@@ -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 {
index c7c01bce4212e56b38e0d3bcaef9e0eb9655dfb2..1c2cd028bd1184371af12d35ccb2070491819389 100644 (file)
@@ -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) {
index 06030298dfeddcce10106072f4fa4b732181b231..ea0a4ded5f9eba6e673b30b2d0cd26ce8cdbf84d 100644 (file)
@@ -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",
index adf4ae26538e8013044eb5385fd7ecc7327699b0..5236014a1b4470c6bd1119c8558bc0c72c592a16 100644 (file)
@@ -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)));
index 4333f157c118d009dd7d3115c7ea7ffb545b1ce1..2ccaffd60173100c035377ab2f5a07f967ad1d35 100644 (file)
@@ -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"));
     }
index bdae5ae72a89aa0a19f47cdac4c492f8f3280291..93a841f61b6009bde4fc8037ac213113c7d3c58e 100644 (file)
@@ -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(",")));
     }
index 9afd9d286d392f1f1d41235068da8de346e9b389..a687897662bd79d1b549b9045e48471c261a26c9 100644 (file)
@@ -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());
     }
 
     /**
index c1dd7164524e28b2ebd625f40bbebebab6dfb59e..47427d9dde157e3a3ee13ff7e4c7667dff6eaa78 100644 (file)
@@ -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) {
index f7fdb2dcff425f299bb3ee44cbb496908609afcf..87650398e9355e6daf3b3d058f90ca38fa578f9a 100644 (file)
@@ -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);
   }
 }
index 1759226c775a191ec9a587ab2805ee358c4a0148..ca67ccc83e87ca676176ebe99e5415789ba3d340 100644 (file)
@@ -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();
     }
index cac3cd879453153188186ff575d1c71735387df8..e3dca59c8e2e2e76f9d91689f0f84a481a9c6262 100644 (file)
@@ -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;
   }
index 6eb8842a2c05cfcf67ad0bde990aa2eb70c85e4d..fdf51ff032c46f8552abd020fd00b1ca2fc25718 100644 (file)
@@ -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);
     }
index 32adffd1441a276b562e3b6e1d1041460eb53811..41e0a620f5b578f2bcb3c8f08b4edbbe4e1fac5e 100644 (file)
@@ -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();
     }
   }
 
index 4ad6a73815fe6beddde4ca45bc651336bdc88294..ef0a870ae6cca929dff8ee0e51888dd859f28511 100644 (file)
@@ -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
index 154e0c829bb1d7e7a07d0d1f5423afb3efb4b64b..0512e88e6856ea8a776a8f8260ee1ae5c3fa41fa 100644 (file)
@@ -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) {
index fb6ea87e7bca33f9be2f95bc4d45a61b621e7f73..ddd8886a0f2e6cbddfbb6ec1c391f174d3fd48f6 100644 (file)
@@ -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) {
index 2a5db2167ba7058e89f508face2e52391c8791b5..7e1880b481f34f9a4a41aab03adb31e6ed5c9d01 100644 (file)
@@ -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;
index 063f5773ac398f0467bcaa5407672fcea00dfc16..e2788ce51260e99a4afc818cc7736739ffa49d2b 100644 (file)
@@ -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();
   }
 }
index 552bcea778fefd6ffacd27bda65974c91ce918ec..59cd39923b461ca9df6a617e1e7ff9e7376df1ce 100644 (file)
@@ -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)
index 02c9388375648e9d3f176a43ee3ae04feab6690a..2dfa88bf16448a7ddbf8d63eb624683dfd74d719 100644 (file)
@@ -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()
index 100eac83edd79385e857565be3ab6baac07b1a68..062366ab244c23bea707c4bec7cc4998a62eb368 100644 (file)
@@ -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) {
index a0c3b3ef1df1627a1c8ce1e0f7d68b29bb211c57..34b653d9a690099b577020c52d76b4cba1161af2 100644 (file)
@@ -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();
index 77067fa8e800c93c7882dfab68afcab826405e73..8d54c3e5f4e9c7822780fa595a3688943c5c0a92 100644 (file)
@@ -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) {
index 2d1dfe2ed8ee174bf1837129e5680fb71e4785b9..4a03dd19e765a58af8da35b3a49de67a76348174 100644 (file)
@@ -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
index c634b1783c8f9c82214aa65b3902fdcb7fb3232a..e926c85d6c0c1b8c6aa9d6ad6959dccd9a23a445 100644 (file)
@@ -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();
   }
 
 }
index 4df08e2c9ccc1bfff3a305cc721c984da44f8bb4..f8f75ebd7ebfd29d5d92aaabf0020ec271844ac5 100644 (file)
@@ -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());
   }
 
   /**
index 11b2df502b9735d8c290f50f805244f8c2074ec1..060e8f8341f679998e2165650a649d3c96937088 100644 (file)
@@ -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) {
index 88eab297ea5b6e8f7484983b66964513439d81b6..920f359599714d06837979a53efc9c30d9079d48 100644 (file)
@@ -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() {
index a71cd49349ed5bbc3d8731fcdcc44fb64c64f711..a0a4b8f0206c4a19e9ced77cca27d25d0152da55 100644 (file)
@@ -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) {
index c26c2a19a084904559640939c9e8610927b1977b..a7cdf8713af72fe550ec31fe895b43a359670be7 100644 (file)
@@ -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();
   }
 }
index b874879c658b8a4238bc3e856782704c2f27d4c6..f2807079b779e1631a3aee4672dac440645c67d4 100644 (file)
@@ -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) {
index 2eea7bdad58ea9d0ca33cacd7e56d94bfe0dfaea..5e4cbeff5b436572f2d4c2efe75057c37f49a571 100644 (file)
@@ -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;
     }
 
index 73220e1072d5644f9935335e0f584468bfdedd1b..dc23867022a11af9aed3da461376e7796be728e5 100644 (file)
@@ -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();
   }
 }
index d2f1222e2fbec4154e1c9561b2e05e808ca11291..0eddf3ffe482aac3b11d4c025b4493c73328b619 100644 (file)
@@ -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);
   }
index 12b092a6a00aa9000e777c96c3e1a204fbee5dec..b99603eec91129ebc5347478ce28de5b9c392aa9 100644 (file)
@@ -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;
index 1be94127becfe48e38beeada169cc113e0d93408..79c34112ce6159a79e3da46bfbb75daeadbe606c 100644 (file)
@@ -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));
index 808e066175a3be70e7939843da904f4307090fd4..84368c780c3dd0ac28c8256fa45bdf84ca974579 100644 (file)
@@ -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()
index efef04bed9c785dbc6a1e8ea251fb0d6d0fc2f55..f106c9ce01c00b367dd6ba8b290c8fd4878ee267 100644 (file)
@@ -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,
index 870180f43ced7ebec1de83853e3db965a6a517eb..fa02817876f34dccf07f8ede6cab60af34500dee 100644 (file)
@@ -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) {
index a8040af5dde03b11689b2bb0ed28b50ce1f69a91..1b872b6720af647b7a81d9975778409f3cef5da2 100644 (file)
@@ -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) {
index 37ff4e4546346d8d0cdb4732cae61e9c61a6b899..23fd0db37a8e3de706864602707bc5359a5df674 100644 (file)
@@ -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) {
index abd2d87c0f25a3ca20f6472caa9675290cb25f95..429f9b041963f1d3c22c60ddd024e22a7243b9b4 100644 (file)
@@ -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();
index 0ea8785c9ec464233fdf9d61e2020ed7a1c56fc4..b5e11fe4655bff622c9f7fa41014cb6b0cf789b3 100644 (file)
@@ -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());
 
index b0c5def74279a54d186c5a0b32f6e405bfa7725a..e3d3eb98bcbc40501351a7d56b65ee15bcf78911 100644 (file)
@@ -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)
index ae058af69219582b1efc733a7bca8bb18147026a..cee13d6219a51b4ad03500135a1813019644b264 100644 (file)
@@ -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();
index 86779141dae26f838064a40878cc680690b34d07..5d45a796056ce95ebce8259effe7e8decc6adccc 100644 (file)
@@ -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())
index 43d9709e0e03ad5899d74522a8a1b6f9233eeddb..fde8246eb6cfedfbed6c5fae81524476e5eb6987 100644 (file)
@@ -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())
index 0458ef84e74982056961b7cbffee6800c6133d5b..575c832072ea304b16a05f83bd021c9d065f2a0c 100644 (file)
@@ -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();
     }
index 208aa65c933e21ed03277998d3ea5577077a71b3..33311c4c8ce79c1676cf2bedb9328f8677d2eba3 100644 (file)
@@ -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)
index 25bd1b3e426cbf52ce64e55ba34fd3ac87d2f18b..ddd5a0965eebcb95a3538fec521ef7ad11f0d339 100644 (file)
@@ -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));
index dabf7cb821a06fac40fd9a0e79087a9ce544984c..2f8f202297e73fb4216f0398659431ed97eef1a0 100644 (file)
@@ -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();
   }
index f4b2ef77fbffcca28029b96c5ec2be419be38126..54f941beb71e3e4a03680833869f8cd060e0baff 100644 (file)
@@ -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));
index c523343063749c99b8f839f7e8acea5665118046..35f06d7f03501565057c92c1ff0ef96f00671d64 100644 (file)
@@ -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));
   }
 
index 102e017936db7d611646a954fb88ebd8f9e05d38..a3b0ee6a65bcc6140ad8b9b62895f71510aa18a2 100644 (file)
@@ -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();
   }
 }
index a1120098f0ffc94f62a15b80fea4b9271890749c..8544caaff509b1ff8203d3df98eb7fe4955e6ba4 100644 (file)
@@ -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) {
index b694d5d01975765496ac771c0c5a1b1c1a5cf4bd..c907f1a8cad63279ba2cfa726b5e61556fc9d076 100644 (file)
@@ -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) {
index e99eb3f4657a02e011e01874573d09539625a7f8..9b2a3795988094515bb6dd8e2a341bd5f167be3b 100644 (file)
@@ -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));
index f93cc5734c76f089c00329cab7b363faeaeddaf1..6c0c69a7c77f9803e93ffcd44a439f4664d46135 100644 (file)
@@ -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()));
index 19d7e4ab5321d46bff4ba2b363c87132ea8eed1d..0fadbc7a96ce9e8fe93e715625a5ccc3a4b4a4ed 100644 (file)
@@ -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");
index 4960a7d5103f0005c3141a2ed34ef0ca1da57e2e..e22262d64289fbd8bf8ae21009306bc8d26c861d 100644 (file)
@@ -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) {
index dbd4f1c6330b9343e7b7c22cb1a84b63fad44900..f5e31b40bcf19f29795cd3f54689bdbc962ace72 100644 (file)
@@ -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) {
index e2811f01c21fa415c5c79a1088590fb53b6a02d1..646934a4ede895ca7c479e03cc7a504f313b32c7 100644 (file)
@@ -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) {
index b47f35d90d4cd9cb25b410b5bc52c23177dab30a..6d62cf65a33aafa8c7dc80eb3aa24a9e8fb24cd5 100644 (file)
@@ -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
index 0524d13bb3a1d1aaed9972fa5392a5be1b055430..887e402a08953de51b19829ee5c46dec9305663e 100644 (file)
@@ -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();
     }
 
     /**
index 91e58e127344b6cc10a1c3451fb785bdb21620e3..7e755478ae80099b2ca7d72ed3220c7b1685726e 100644 (file)
@@ -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);
   }
 
index 1bdd0d61e27b3bbe826abf25fa399604a0af7921..12ba2fab6ebc28cc6ef867ea595401e937f06a56 100644 (file)
@@ -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) {
index f09fa1f6c4c896153841c4ccff3fc73b09c55691..45c46bda73aa86dc7da0318650724e84c225e135 100644 (file)
@@ -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)
index 109d8fdf37c233cce4e56529bdb745e865ddf748..d675ed0692cde7e86228bd6e5d424108eb96da66 100644 (file)
@@ -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);
   }
 }
index aa839c82a504314ded084b370db6a1889f600e41..940d2bae2751880dcdcbdf6a962f164581726e7d 100644 (file)
@@ -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);
     }
index e8c1e2dc6d1ad3668edf506da75713a65900a7b4..7117602c74b29f9c2dcd33e9e8168e94754171a3 100644 (file)
@@ -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();
   }
 
 }
index 8de2eb98730a13fc8e23bdaf6057a5dd2cfb1845..0dfa202de969c0deea961522ff486ac82a70e623 100644 (file)
@@ -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();
   }
 }
index d347cf5aeac7680cd5e4eba8c05ad7a416b1c88a..6f9ce1950dca67fd08b524c51a9ebf32cdc0fccd 100644 (file)
@@ -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) {
index 2a1e65350b09decb20c33aeacdd6e2d79e2a64b9..e72c3752619cc2c035815a6254a2a22e2ac775f7 100644 (file)
@@ -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) {
index 2a1d68b210dc2bae13d14a8f4c2febf75ee7fe84..35d1bb3f2679311e290f20e7619d8ab6501617b5 100644 (file)
@@ -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);
   }
 
index 67506cef44d667fa9c574c409798748c86ded4ba..3caa2195cb678e50b9b4aafd23669508b0e7e90f 100644 (file)
@@ -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);
   }
index 4522b5c274c07b6c09dad220142b73648305bc4a..66c5c97bc1ab6ff88d58c28916ad44cb737af305 100644 (file)
@@ -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) {
index c152a7d17bd6e1a096efc56ca6907a43f55ba6de..719d225f969001f91e289a108f714ff070abb552 100644 (file)
@@ -100,7 +100,7 @@ public class SearchAction implements ProjectLinksWsAction {
     return SearchWsResponse.newBuilder()
       .addAllLinks(links.stream()
         .map(SearchAction::buildLink)
-        .collect(Collectors.toList()))
+        .toList())
       .build();
   }
 
index fcc2235c5d71124d631303eea698a041bf02b1e5..0b6ee2b475eb1f43819e7063e7e359aef33ba54a 100644 (file)
@@ -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;
 
index 9b5903daa3418e208fece84b8af5f09b753a9514..19dd5487ba320920d7bdca33aea82c7d8f251997 100644 (file)
@@ -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) {
index f8162c14ad6326e01dc8909f19df903ad693ba4f..06379246b97edf162e6f403ab8e0fc5f1bde29aa 100644 (file)
@@ -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))
index eb26943031423dfeb30c2509bdb7648a12d5fb11..0f4adba5154f04423b56db2de2b33c7a4fe92c4e 100644 (file)
@@ -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) {
index 82f9c27d338bd385dd54a4b129b07dffc1fcd74c..d6db7bf4ec535ce7e82cf392091c61c523507090 100644 (file)
@@ -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;
index 3f209ca71724ceda0f976672a417b143daa18009..ab1040443ec494e4f66e78f365c2a7ca7fba8ba7 100644 (file)
@@ -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)
index 7529e686640249812e1656b7f43d7dfa438723fe..568efa6db82a888d11e1d1901507ad4dd941b9a2 100644 (file)
@@ -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) {
index 9da8e3244f867742ae7246fcbce2cbe272ece7e6..a6340a13eb4e7f25a7644f04edb96776249f9d67 100644 (file)
@@ -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) {
index 30c259a24cb331ba21c7db84513da42f713c6018..b711fba61129a59a3bb933c2616c6b80d3eecfb2 100644 (file)
@@ -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() {
index f9d102a8818c85b3b96a21388b2d328e2fb0a359..cb1150445935cc2724c1bffa8a209f6165263d3b 100644 (file)
@@ -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) {
index b1096c5fcbbf65c1b22a1088daddf184bfa5b454..00c4f510b5fad3275b9cc05b71c9ce416e826fa8 100644 (file)
@@ -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) {
index 66744b86d64adc394393075dfb53c2315ce76a01..654a508fcc3db96858889a7395267cebe4b32cf1 100644 (file)
@@ -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");
 
index 386adfdfe4d1620908bae8cf73e4c5218b2dccfc..efba2d8021340a0bb02f2d346d1135bc82efba6a 100644 (file)
@@ -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());
       }
index 221caa4eafc958739454473d3995664569d440ba..69fd7d929d114a0bca404ac0b0706b8be1c75862 100644 (file)
@@ -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
index 6288d8fe2baa895d20ef8874c3f2877c6dd695e6..a5ce4c1cc06ff7d199d602afe6b735f1711979fb 100644 (file)
@@ -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);
index 660bd9e12e173ec6091118ba120a7cd512574d7c..082b73bf7d1852e4ed87d27dc015ddd8fa49bd17 100644 (file)
@@ -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(", ")));
       }
index 0c364dc3b909b36b337d5856dbcc34c6e7d5617a..a4e9a526d311dcc296817b582e19e15b9fd1d728 100644 (file)
@@ -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);
     }
 
index 05dc60e40204db8ab4f55927980fa5394e352f6a..f4409758de2d8786907e7500e4ee1d10445dfb79 100644 (file)
@@ -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;
index d3b7a0dd4f00ee6f187ec9136285186d87ddc830..8c8de6fcf660042d56a1c52ac1e71234e4487d42 100644 (file)
@@ -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();
index 17dfe192cb9f56133389aebc1b23fac2e4cacee3..78ed24a93577a9e697a6c790398b2e171817a963 100644 (file)
@@ -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) {
index 3bc020a973df5857046fb5fe05c759dea4e515aa..cd0558ef0dd143c8d0279bede7988d0771780658 100644 (file)
@@ -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
index bd11714f992859d5a485242edfbae275413d01cc..b9034d38722a5e5543d293f029c580534d536c16 100644 (file)
@@ -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) {
index 0eac1b08f6adf1fc25ee51e4b757d99815465891..247977052f1502dc9c110f5bbd2c67cedb187f8a 100644 (file)
@@ -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();
   }
 }
index 8fac83677166616a1e961a57a41f0a56192c9754..0b0789cec061bb0dabc793b57e41bea88c36153c 100644 (file)
@@ -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");
   }
index d9662c6f135bae276cbe3b8d4655ee9cdf938aef..7e5f3504f58538953a8877c435d451fed7448c4f 100644 (file)
@@ -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)
index 91cfdca501603080f4165edaab5fd5e48a083875..d562fbb8ec53ac9ab1e7b8c5591756727d55b185 100644 (file)
@@ -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());
index 6710e02e1ed2836241d2c77c168466b4fed01bea..689fdc39bf7a6229648e044e737bd0ae3bbf16d1 100644 (file)
@@ -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();
   }
 
 }