aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-31 14:56:28 +0100
committerdbmeneses <duarte.meneses@sonarsource.com>2017-01-31 17:14:13 +0100
commitf4e4e1f30da63c41701e237f92d55171c7d5b927 (patch)
tree16b1c2f08aff3354f4524e0a582633797f41b77a /sonar-scanner-engine/src/main/java/org/sonar/scanner/scan
parent664d1ea8246b368222ca545e8a26f0b8c7acfabd (diff)
downloadsonarqube-f4e4e1f30da63c41701e237f92d55171c7d5b927.tar.gz
sonarqube-f4e4e1f30da63c41701e237f92d55171c7d5b927.zip
Reduce dependency on guava
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/scan')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/DefaultModuleFileSystem.java6
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/LanguageDetection.java8
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializer.java6
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/DeprecatedMetricFinder.java10
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ResourceReport.java13
6 files changed, 24 insertions, 23 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java
index c5f4dbaa3d7..b167347ad0c 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java
@@ -19,7 +19,7 @@
*/
package org.sonar.scanner.scan;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -79,7 +79,7 @@ public class ModuleSettings extends Settings {
* From root to given project
*/
static List<ProjectDefinition> getTopDownParentProjects(ProjectDefinition project) {
- List<ProjectDefinition> result = Lists.newArrayList();
+ List<ProjectDefinition> result = new ArrayList<>();
ProjectDefinition p = project;
while (p != null) {
result.add(0, p);
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/DefaultModuleFileSystem.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/DefaultModuleFileSystem.java
index 3baf5893654..da55a202d6c 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/DefaultModuleFileSystem.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/DefaultModuleFileSystem.java
@@ -20,9 +20,9 @@
package org.sonar.scanner.scan.filesystem;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
import java.io.File;
import java.nio.charset.Charset;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.CoreProperties;
@@ -42,8 +42,8 @@ public class DefaultModuleFileSystem extends DefaultFileSystem {
private FileIndexer indexer;
private Settings settings;
- private List<File> sourceDirsOrFiles = Lists.newArrayList();
- private List<File> testDirsOrFiles = Lists.newArrayList();
+ private List<File> sourceDirsOrFiles = new ArrayList<>();
+ private List<File> testDirsOrFiles = new ArrayList<>();
private boolean initialized;
private Charset charset = null;
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/LanguageDetection.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/LanguageDetection.java
index 847f3f2f364..50b4c8cdf29 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/LanguageDetection.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/LanguageDetection.java
@@ -20,9 +20,9 @@
package org.sonar.scanner.scan.filesystem;
import com.google.common.base.Joiner;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
@@ -49,8 +49,8 @@ public class LanguageDetection {
/**
* Lower-case extension -> languages
*/
- private final Map<String, PathPattern[]> patternsByLanguage = Maps.newLinkedHashMap();
- private final List<String> languagesToConsider = Lists.newArrayList();
+ private final Map<String, PathPattern[]> patternsByLanguage = new LinkedHashMap<>();
+ private final List<String> languagesToConsider = new ArrayList<>();
private final String forcedLanguage;
public LanguageDetection(Settings settings, LanguagesRepository languages) {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializer.java
index e0bdd64dc4b..f37c3267b0b 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializer.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ModuleFileSystemInitializer.java
@@ -19,8 +19,8 @@
*/
package org.sonar.scanner.scan.filesystem;
-import com.google.common.collect.Lists;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.sonar.api.batch.ScannerSide;
@@ -36,8 +36,8 @@ public class ModuleFileSystemInitializer {
private File baseDir;
private File workingDir;
- private List<File> sourceDirsOrFiles = Lists.newArrayList();
- private List<File> testDirsOrFiles = Lists.newArrayList();
+ private List<File> sourceDirsOrFiles = new ArrayList<>();
+ private List<File> testDirsOrFiles = new ArrayList<>();
public ModuleFileSystemInitializer(ProjectDefinition module, TempFolder tempUtils, PathResolver pathResolver) {
baseDir = module.getBaseDir();
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/DeprecatedMetricFinder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/DeprecatedMetricFinder.java
index ef64f649cf2..8507fbbfc69 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/DeprecatedMetricFinder.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/measure/DeprecatedMetricFinder.java
@@ -19,9 +19,9 @@
*/
package org.sonar.scanner.scan.measure;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.sonar.api.measures.Metric;
@@ -30,8 +30,8 @@ import org.sonar.scanner.repository.MetricsRepository;
public final class DeprecatedMetricFinder implements MetricFinder {
- private Map<String, Metric> metricsByKey = Maps.newLinkedHashMap();
- private Map<Integer, Metric> metricsById = Maps.newLinkedHashMap();
+ private Map<String, Metric> metricsByKey = new LinkedHashMap<>();
+ private Map<Integer, Metric> metricsById = new LinkedHashMap<>();
public DeprecatedMetricFinder(MetricsRepository metricsRepository) {
for (Metric metric : metricsRepository.metrics()) {
@@ -52,7 +52,7 @@ public final class DeprecatedMetricFinder implements MetricFinder {
@Override
public Collection<Metric> findAll(List<String> metricKeys) {
- List<Metric> result = Lists.newLinkedList();
+ List<Metric> result = new LinkedList<>();
for (String metricKey : metricKeys) {
Metric metric = findByKey(metricKey);
if (metric != null) {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ResourceReport.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ResourceReport.java
index fb6782b3d91..8a70a49b7d5 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ResourceReport.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ResourceReport.java
@@ -19,9 +19,10 @@
*/
package org.sonar.scanner.scan.report;
-import com.google.common.collect.Maps;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -40,13 +41,13 @@ import org.sonar.scanner.issue.tracking.TrackedIssue;
public final class ResourceReport {
private final InputComponent component;
private final IssueVariation total = new IssueVariation();
- private final Map<ReportRuleKey, RuleReport> ruleReportByRuleKey = Maps.newHashMap();
+ private final Map<ReportRuleKey, RuleReport> ruleReportByRuleKey = new HashMap<>();
private List<TrackedIssue> issues = new ArrayList<>();
- private Map<Integer, List<TrackedIssue>> issuesPerLine = Maps.newHashMap();
- private Map<Integer, List<TrackedIssue>> newIssuesPerLine = Maps.newHashMap();
- private Map<Rule, AtomicInteger> issuesByRule = Maps.newHashMap();
- private Map<RulePriority, AtomicInteger> issuesBySeverity = Maps.newHashMap();
+ private Map<Integer, List<TrackedIssue>> issuesPerLine = new HashMap<>();
+ private Map<Integer, List<TrackedIssue>> newIssuesPerLine = new HashMap<>();
+ private Map<Rule, AtomicInteger> issuesByRule = new HashMap<>();
+ private Map<RulePriority, AtomicInteger> issuesBySeverity = new EnumMap<>(RulePriority.class);
public ResourceReport(InputComponent component) {
this.component = component;