diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2023-12-04 12:50:58 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-12-04 20:03:22 +0000 |
commit | d62a56ecfd4cf2f183873900fd32cffc4743c7fb (patch) | |
tree | 552481ceb8b8cab34f74b59563b58278ffa62f69 /plugins | |
parent | cdda3dbcdd4e4b5f4a2e7471a37fa66877e26aad (diff) | |
download | sonarqube-d62a56ecfd4cf2f183873900fd32cffc4743c7fb.tar.gz sonarqube-d62a56ecfd4cf2f183873900fd32cffc4743c7fb.zip |
SONAR-21174 Fix code smells raised after dropping JDK11 support
Diffstat (limited to 'plugins')
3 files changed, 3 insertions, 6 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/variant/CodeVariantSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/variant/CodeVariantSensor.java index 53fa9f7e68a..7173402cae5 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/variant/CodeVariantSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/variant/CodeVariantSensor.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.rule.ActiveRules; @@ -63,7 +62,7 @@ public abstract class CodeVariantSensor extends AbstractXooRuleSensor { String contents = inputFile.contents(); List<String> identifiedVariants = variants.stream() .filter(contents::contains) - .collect(Collectors.toList()); + .toList(); if (!identifiedVariants.isEmpty()) { NewIssue newIssue = context.newIssue() diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java index dc55110a24d..a82e7391545 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/scm/XooBlameCommand.java @@ -34,7 +34,6 @@ import org.sonar.api.batch.scm.BlameLine; import org.sonar.api.utils.DateUtils; import static com.google.common.base.Preconditions.checkState; -import static java.util.stream.Collectors.toList; import static org.apache.commons.lang.StringUtils.trimToNull; public class XooBlameCommand extends BlameCommand { @@ -73,7 +72,7 @@ public class XooBlameCommand extends BlameCommand { List<CSVRecord> records = csvParser.getRecords(); return records.stream() .map(r -> convertToBlameLine(now, r)) - .collect(toList()); + .toList(); } } diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/MultilineIssuesSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/MultilineIssuesSensorTest.java index e610ad65e19..8654b8028e6 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/MultilineIssuesSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/MultilineIssuesSensorTest.java @@ -22,7 +22,6 @@ package org.sonar.xoo.rule; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; -import java.util.stream.Collectors; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -79,7 +78,7 @@ public class MultilineIssuesSensorTest { List<Issue.Flow> flows = issue.flows(); assertThat(flows).hasSize(2); - List<DefaultIssueFlow> defaultIssueFlows = flows.stream().map(DefaultIssueFlow.class::cast).collect(Collectors.toList()); + List<DefaultIssueFlow> defaultIssueFlows = flows.stream().map(DefaultIssueFlow.class::cast).toList(); assertThat(defaultIssueFlows).extracting(DefaultIssueFlow::type).containsExactlyInAnyOrder(FlowType.DATA, FlowType.EXECUTION); assertThat(flows.get(0).locations()).extracting(IssueLocation::messageFormattings).isNotEmpty(); |