aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2023-07-07 08:49:05 +0200
committersonartech <sonartech@sonarsource.com>2023-07-17 20:03:45 +0000
commitc62e96c1586baff4fcb6ffb71c2166686c6dbb68 (patch)
tree80c2e1c3e754d179833ebaad2db2c1cefb94db5c /server/sonar-webserver-core
parent470a55b6ae21f203d5f0fa27e4b7d114d3922902 (diff)
downloadsonarqube-c62e96c1586baff4fcb6ffb71c2166686c6dbb68.tar.gz
sonarqube-c62e96c1586baff4fcb6ffb71c2166686c6dbb68.zip
NO-JIRA replace Collectors.toList to Stream.toList
Diffstat (limited to 'server/sonar-webserver-core')
-rw-r--r--server/sonar-webserver-core/src/it/java/org/sonar/server/webhook/WebhookQGChangeEventListenerIT.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java3
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java8
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java2
5 files changed, 9 insertions, 8 deletions
diff --git a/server/sonar-webserver-core/src/it/java/org/sonar/server/webhook/WebhookQGChangeEventListenerIT.java b/server/sonar-webserver-core/src/it/java/org/sonar/server/webhook/WebhookQGChangeEventListenerIT.java
index 37c34c09936..0184ea14cc7 100644
--- a/server/sonar-webserver-core/src/it/java/org/sonar/server/webhook/WebhookQGChangeEventListenerIT.java
+++ b/server/sonar-webserver-core/src/it/java/org/sonar/server/webhook/WebhookQGChangeEventListenerIT.java
@@ -239,7 +239,7 @@ public class WebhookQGChangeEventListenerIT {
.setAnalysisUuid(snapshotUuid)
.setKey(entry.getKey())
.setValue(entry.getValue()))
- .collect(Collectors.toList());
+ .toList();
dbTester.getDbClient().analysisPropertiesDao().insert(dbTester.getSession(), analysisProperties);
dbTester.getSession().commit();
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
index e64b834cbc6..68e40bd6481 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.platform;
+import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.sonar.api.utils.text.JsonWriter;
@@ -47,7 +48,7 @@ public class StandaloneSystemInfoWriter extends AbstractSystemInfoWriter {
List<ProtobufSystemInfo.Section> sections = stream(systemInfoSections)
.map(SystemInfoSection::toProtobuf)
- .collect(Collectors.toList());
+ .collect(Collectors.toCollection(ArrayList::new));
ceHttpClient.retrieveSystemInfo()
.ifPresent(ce -> sections.addAll(ce.getSectionsList()));
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
index 4116d8099f9..5d84e034432 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
@@ -316,7 +316,7 @@ public class RegisterRules implements Startable {
}
private void persistRepositories(DbSession dbSession, List<RulesDefinition.Repository> repositories) {
- List<String> keys = repositories.stream().map(RulesDefinition.Repository::key).collect(Collectors.toList());
+ List<String> keys = repositories.stream().map(RulesDefinition.Repository::key).toList();
Set<String> existingKeys = dbClient.ruleRepositoryDao().selectAllKeys(dbSession);
Map<Boolean, List<RuleRepositoryDto>> dtos = repositories.stream()
@@ -637,7 +637,7 @@ public class RegisterRules implements Startable {
// DeprecatedKeys that must be deleted
List<String> uuidsToBeDeleted = difference(deprecatedRuleKeysFromDB, deprecatedRuleKeysFromDefinition).stream()
.map(SingleDeprecatedRuleKey::getUuid)
- .collect(Collectors.toList());
+ .toList();
dbClient.ruleDao().deleteDeprecatedRuleKeys(dbSession, uuidsToBeDeleted);
@@ -822,7 +822,7 @@ public class RegisterRules implements Startable {
private static void verifyRuleKeyConsistency(List<RulesDefinition.Repository> repositories, RegisterRulesContext registerRulesContext) {
List<RulesDefinition.Rule> definedRules = repositories.stream()
.flatMap(r -> r.rules().stream())
- .collect(Collectors.toList());
+ .toList();
Set<RuleKey> definedRuleKeys = definedRules.stream()
.map(r -> RuleKey.of(r.repository().key(), r.key()))
@@ -830,7 +830,7 @@ public class RegisterRules implements Startable {
List<RuleKey> definedDeprecatedRuleKeys = definedRules.stream()
.flatMap(r -> r.deprecatedRuleKeys().stream())
- .collect(Collectors.toList());
+ .toList();
// Find duplicates in declared deprecated rule keys
Set<RuleKey> duplicates = findDuplicates(definedDeprecatedRuleKeys);
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java
index c429d743a11..0a42ff2d5d1 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java
@@ -81,7 +81,7 @@ public class SingleDeprecatedRuleKeyTest {
.containsExactlyInAnyOrder(
deprecatedRuleKeys.stream().map(
r -> tuple(null, r.repository(), r.rule(), rule.repository().key(), rule.key(), RuleKey.of(r.repository(), r.rule())))
- .collect(Collectors.toList()).toArray(new Tuple[deprecatedRuleKeys.size()]));
+ .toList().toArray(new Tuple[deprecatedRuleKeys.size()]));
}
@Test
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
index 2bfc6b6064f..4d270bcb0cf 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
@@ -332,7 +332,7 @@ public class TelemetryDataLoaderImplTest {
.rangeClosed(1, count)
.mapToObj(userConfigurator::apply)
.map(userDbTester::insertUser)
- .collect(Collectors.toList());
+ .toList();
}
private void assertDatabaseMetadata(TelemetryData.Database database) {