From 906a5e3ee07d3d36b09798fd8894e314633e293b Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 28 Aug 2014 18:35:08 +0200 Subject: [PATCH] Fix some quality flaws --- .../highlighting/SyntaxHighlightingDataValueCoder.java | 3 ++- .../java/org/sonar/batch/mediumtest/BatchMediumTester.java | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/highlighting/SyntaxHighlightingDataValueCoder.java b/sonar-batch/src/main/java/org/sonar/batch/highlighting/SyntaxHighlightingDataValueCoder.java index b3be41fa2f6..621c1e5c2f5 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/highlighting/SyntaxHighlightingDataValueCoder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/highlighting/SyntaxHighlightingDataValueCoder.java @@ -24,6 +24,7 @@ import com.persistit.encoding.CoderContext; import com.persistit.encoding.ValueCoder; import java.util.ArrayList; +import java.util.List; public class SyntaxHighlightingDataValueCoder implements ValueCoder { @@ -41,7 +42,7 @@ public class SyntaxHighlightingDataValueCoder implements ValueCoder { @Override public Object get(Value value, Class clazz, CoderContext context) { int count = value.getInt(); - ArrayList rules = new ArrayList(count); + List rules = new ArrayList(count); for (int i = 0; i < count; i++) { rules.add((SyntaxHighlightingRule) rulesCoder.get(value, SyntaxHighlightingRule.class, context)); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java index bdb052ddc1e..be3185f7b6d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java @@ -19,8 +19,6 @@ */ package org.sonar.batch.mediumtest; -import org.sonar.api.batch.sensor.highlighting.TypeOfText; - import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,6 +30,7 @@ import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.InputPath; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.sensor.duplication.DuplicationGroup; +import org.sonar.api.batch.sensor.highlighting.TypeOfText; import org.sonar.api.batch.sensor.issue.Issue; import org.sonar.api.batch.sensor.measure.Measure; import org.sonar.api.batch.sensor.symbol.Symbol; @@ -67,6 +66,7 @@ import javax.annotation.CheckForNull; import java.io.File; import java.io.FileReader; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -291,11 +291,10 @@ public class BatchMediumTester { * Get highlighting types at a given position in an inputfile * @param charIndex 0-based offset in file */ - @CheckForNull public List highlightingTypeFor(InputFile file, int charIndex) { SyntaxHighlightingData syntaxHighlightingData = highlightingPerFile.get(file); if (syntaxHighlightingData == null) { - return null; + return Collections.emptyList(); } List result = new ArrayList(); for (SyntaxHighlightingRule sortedRule : syntaxHighlightingData.syntaxHighlightingRuleSet()) { -- 2.39.5