diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-12-09 09:34:43 -0600 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-12-10 20:46:09 +0100 |
commit | d1fd889554bccbb50122550899dbb66b90b04f78 (patch) | |
tree | 9cad838366292ee79b77ac3513403f7489b06355 /plugins/sonar-xoo-plugin/src | |
parent | f86a1094588e4e47b3abf612891af0431653cd0e (diff) | |
download | sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.tar.gz sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.zip |
Fix code quality issues and reduce dependency on Guava
Diffstat (limited to 'plugins/sonar-xoo-plugin/src')
3 files changed, 7 insertions, 8 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java index 76c839d1a07..c058af0d199 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java @@ -50,7 +50,7 @@ public class ChecksSensor implements Sensor { @Override public void execute(SensorContext context) { Checks<Check> checks = checkFactory.create(XooRulesDefinition.XOO_REPOSITORY); - checks.addAnnotatedChecks((Object[]) Check.ALL); + checks.addAnnotatedChecks(Check.ALL); FilePredicates p = context.fileSystem().predicates(); for (InputFile file : context.fileSystem().inputFiles(p.and(p.hasLanguages(Xoo.KEY), p.hasType(Type.MAIN)))) { for (Check check : checks.all()) { diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java index c1592e3cf8b..7c91f7c7120 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java @@ -21,11 +21,11 @@ package org.sonar.xoo.rule; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Table; import java.io.IOException; import java.nio.file.Files; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; @@ -70,10 +70,10 @@ public class MultilineIssuesSensor implements Sensor { } private static void createIssues(InputFile file, SensorContext context) { - Map<Integer, TextPointer> startIssuesPositions = Maps.newHashMap(); - Map<Integer, TextPointer> endIssuesPositions = Maps.newHashMap(); - Map<Integer, Table<Integer, Integer, TextPointer>> startFlowsPositions = Maps.newHashMap(); - Map<Integer, Table<Integer, Integer, TextPointer>> endFlowsPositions = Maps.newHashMap(); + Map<Integer, TextPointer> startIssuesPositions = new HashMap<>(); + Map<Integer, TextPointer> endIssuesPositions = new HashMap<>(); + Map<Integer, Table<Integer, Integer, TextPointer>> startFlowsPositions = new HashMap<>(); + Map<Integer, Table<Integer, Integer, TextPointer>> endFlowsPositions = new HashMap<>(); parseIssues(file, context, startIssuesPositions, endIssuesPositions); parseFlows(file, startFlowsPositions, endFlowsPositions); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java index f08e3bd202a..3f2a356d707 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java @@ -42,7 +42,6 @@ public class AnalysisErrorSensorTest { public TemporaryFolder temp = new TemporaryFolder(); private AnalysisErrorSensor sensor; - private SensorContextTester context; @Before public void setUp() { @@ -74,7 +73,7 @@ public class AnalysisErrorSensorTest { .setModuleBaseDir(baseDir) .setLines(4) .build(); - context = SensorContextTester.create(baseDir); + SensorContextTester context = SensorContextTester.create(baseDir); context.fileSystem().add(inputFile); sensor.execute(context); |