From 54b60b1adac5b703398163ee5edf5a621efc0d24 Mon Sep 17 00:00:00 2001 From: Matteo Mara Date: Tue, 10 Jan 2023 15:16:50 +0100 Subject: [NO-JIRA] Remove reported code smells about usages of toList --- .../main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java | 3 +-- .../main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java | 2 +- .../src/main/java/org/sonar/process/logging/LogLevelConfig.java | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'server/sonar-process') diff --git a/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java b/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java index 4333f157c11..2ccaffd6017 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java +++ b/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java @@ -25,7 +25,6 @@ import com.hazelcast.config.MemberAttributeConfig; import com.hazelcast.config.NetworkConfig; import com.hazelcast.core.Hazelcast; import java.util.List; -import java.util.stream.Collectors; import java.util.stream.Stream; import org.sonar.process.ProcessId; import org.sonar.process.cluster.hz.HazelcastMember.Attribute; @@ -110,7 +109,7 @@ public class HazelcastMemberBuilder { .filter(host -> !host.isBlank()) .map(String::trim) .map(HazelcastMemberBuilder::applyDefaultPortToHost) - .collect(Collectors.toList()); + .toList(); joinConfig.getTcpIpConfig().setEnabled(true); joinConfig.getTcpIpConfig().setMembers(requireNonNull(addressesWithDefaultPorts, "Members are missing")); } diff --git a/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java b/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java index bdae5ae72a8..93a841f61b6 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java +++ b/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java @@ -184,7 +184,7 @@ public class Log4JPropertiesBuilder extends AbstractLogHelper { .filter(loggerName -> !ROOT_LOGGER_NAME.equals(loggerName)) .distinct() .sorted() - .collect(Collectors.toList()); + .toList(); if (!loggerNames.isEmpty()) { putProperty("loggers", loggerNames.stream().collect(Collectors.joining(","))); } diff --git a/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java b/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java index 9afd9d286d3..a687897662b 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java +++ b/server/sonar-process/src/main/java/org/sonar/process/logging/LogLevelConfig.java @@ -27,7 +27,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; import java.util.stream.Stream; import org.sonar.process.ProcessId; @@ -107,7 +106,7 @@ public final class LogLevelConfig { private void levelByProperty(String loggerName, String property, String... otherProperties) { ensureUniqueConfiguration(loggerName); - configuredByProperties.put(loggerName, Stream.concat(Stream.of(property), Arrays.stream(otherProperties)).collect(Collectors.toList())); + configuredByProperties.put(loggerName, Stream.concat(Stream.of(property), Arrays.stream(otherProperties)).toList()); } /** -- cgit v1.2.3