diff options
247 files changed, 748 insertions, 0 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index d899b20e496..81326ff34b7 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -280,6 +280,7 @@ import java.util.List; public final class CorePlugin extends SonarPlugin { @SuppressWarnings("rawtypes") + @Override public List getExtensions() { ImmutableList.Builder<Object> extensions = ImmutableList.builder(); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/UserManagedMetrics.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/UserManagedMetrics.java index 1bc1d597a6b..4014e515c44 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/UserManagedMetrics.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/UserManagedMetrics.java @@ -28,6 +28,7 @@ import java.util.List; public final class UserManagedMetrics implements Metrics { private static final String DOMAIN = "Management"; + @Override public List<Metric> getMetrics() { return ImmutableList.<Metric>of( new Metric.Builder("burned_budget", "Burned budget", Metric.ValueType.FLOAT) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java index 79af72f49df..c8f73204e98 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java @@ -36,6 +36,7 @@ public class IndexProjectPostJob implements PostJob { this.indexer = indexer; } + @Override public void executeOn(Project project, SensorContext context) { if (project.getId() != null) { indexer.indexProject(project.getId()); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java index 2ee1c3526ad..3687c85df9a 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionAreaChart.java @@ -34,6 +34,7 @@ import java.text.NumberFormat; public class DistributionAreaChart extends AbstractChart { private static final String PARAM_COLORS = "c"; + @Override public String getKey() { return "distarea"; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java index 23c9a9adebe..ef021132555 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/DistributionBarChart.java @@ -41,6 +41,7 @@ public class DistributionBarChart extends AbstractChart { public static final String PARAM_X_SUFFIX = "xsuf"; public static final String PARAM_FONT_SIZE = "fs"; + @Override public String getKey() { return "distbar"; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java index a4b400fcb0d..41a80bd53e4 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/charts/XradarChart.java @@ -41,6 +41,7 @@ public class XradarChart extends AbstractChart { public static final String PARAM_LABELS = "l"; public static final String PARAM_VALUES = "v"; + @Override public String getKey() { return "xradar"; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountFalsePositivesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountFalsePositivesDecorator.java index 05ad2d8cf8a..c962544de24 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountFalsePositivesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountFalsePositivesDecorator.java @@ -43,6 +43,7 @@ public class CountFalsePositivesDecorator implements Decorator { this.perspectives = perspectives; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -52,6 +53,7 @@ public class CountFalsePositivesDecorator implements Decorator { return CoreMetrics.FALSE_POSITIVE_ISSUES; } + @Override public void decorate(Resource resource, DecoratorContext context) { Issuable issuable = perspectives.as(Issuable.class, resource); if (issuable != null) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java index b80221a2a1a..dfb05e23d9a 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/CountUnresolvedIssuesDecorator.java @@ -78,6 +78,7 @@ public class CountUnresolvedIssuesDecorator implements Decorator { this.timeMachineConfiguration = timeMachineConfiguration; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -103,6 +104,7 @@ public class CountUnresolvedIssuesDecorator implements Decorator { ); } + @Override public void decorate(Resource resource, DecoratorContext context) { Issuable issuable = perspectives.as(Issuable.class, resource); if (issuable != null) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java index ff87130e592..876112646d9 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java @@ -336,6 +336,7 @@ public class IssueTracking implements BatchExtension { } private static final Comparator<LinePair> LINE_PAIR_COMPARATOR = new Comparator<LinePair>() { + @Override public int compare(LinePair o1, LinePair o2) { int weightDiff = o2.weight - o1.weight; if (weightDiff != 0) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java index 1838dc5311e..2f6dbe2f900 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTrackingDecorator.java @@ -90,10 +90,12 @@ public class IssueTrackingDecorator implements Decorator { this.ruleFinder = ruleFinder; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(Resource resource, DecoratorContext context) { Issuable issuable = perspectives.as(Issuable.class, resource); if (issuable != null) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequence.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequence.java index 8bea87b87de..abfc23fc982 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequence.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequence.java @@ -51,6 +51,7 @@ public final class HashedSequence<S extends Sequence> implements Sequence { return new HashedSequence<S>(base, hashes, linesByHash); } + @Override public int length() { return base.length(); } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequenceComparator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequenceComparator.java index 64b122c8f3d..093cf962698 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequenceComparator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/HashedSequenceComparator.java @@ -30,6 +30,7 @@ public class HashedSequenceComparator<S extends Sequence> implements SequenceCom this.cmp = cmp; } + @Override public boolean equals(HashedSequence<S> a, int ai, HashedSequence<S> b, int bi) { if (a.hashes[ai] == b.hashes[bi]) { return cmp.equals(a.base, ai, b.base, bi); @@ -37,6 +38,7 @@ public class HashedSequenceComparator<S extends Sequence> implements SequenceCom return false; } + @Override public int hash(HashedSequence<S> seq, int i) { return seq.hashes[i]; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequence.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequence.java index 714f15f6c69..cb3d7acfc09 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequence.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequence.java @@ -55,6 +55,7 @@ public class RollingHashSequence<S extends Sequence> implements Sequence { this.hashes = hashes; } + @Override public int length() { return base.length(); } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequenceComparator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequenceComparator.java index b28da2052ba..b3663b47d48 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequenceComparator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/RollingHashSequenceComparator.java @@ -30,6 +30,7 @@ public class RollingHashSequenceComparator<S extends Sequence> implements Sequen this.cmp = cmp; } + @Override public boolean equals(RollingHashSequence<S> a, int ai, RollingHashSequence<S> b, int bi) { if (a.hashes[ai] == b.hashes[bi]) { return cmp.equals(a.base, ai, b.base, bi); @@ -37,6 +38,7 @@ public class RollingHashSequenceComparator<S extends Sequence> implements Sequen return false; } + @Override public int hash(RollingHashSequence<S> seq, int i) { return seq.hashes[i]; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringText.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringText.java index 4bab00c922b..50ce2d4912f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringText.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringText.java @@ -40,6 +40,7 @@ public class StringText implements Sequence { this.lines = lineMap(content, 0, content.length()); } + @Override public int length() { return lines.size() - 2; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringTextComparator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringTextComparator.java index 43c0ccee8cd..e7f63900ea1 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringTextComparator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/tracking/StringTextComparator.java @@ -29,6 +29,7 @@ public abstract class StringTextComparator implements SequenceComparator<StringT */ public static final StringTextComparator IGNORE_WHITESPACE = new StringTextComparator() { + @Override public boolean equals(StringText a, int ai, StringText b, int bi) { ai++; bi++; @@ -72,6 +73,7 @@ public abstract class StringTextComparator implements SequenceComparator<StringT }; + @Override public int hash(StringText seq, int line) { final int begin = seq.lines.get(line + 1); final int end = seq.lines.get(line + 2); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java index 30d23a48c09..7e997924fda 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/ApplyProjectRolesDecorator.java @@ -41,10 +41,12 @@ public class ApplyProjectRolesDecorator implements Decorator { this.resourcePermissions = resourcePermissions; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource)) { LoggerFactory.getLogger(ApplyProjectRolesDecorator.class).info("Grant default permissions to {}", resource.getKey()); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AbstractCoverageDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AbstractCoverageDecorator.java index 25c5d0942bf..c4c39208422 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AbstractCoverageDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AbstractCoverageDecorator.java @@ -33,6 +33,7 @@ import java.util.Collection; public abstract class AbstractCoverageDecorator implements Decorator { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -42,6 +43,7 @@ public abstract class AbstractCoverageDecorator implements Decorator { return Arrays.asList(getGeneratedMetric(), getGeneratedMetricForNewCode()); } + @Override public void decorate(final Resource resource, final DecoratorContext context) { if (shouldDecorate(resource)) { computeMeasure(context); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java index 3bba4a2a52d..76a54e7da55 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CommentDensityDecorator.java @@ -45,10 +45,12 @@ public class CommentDensityDecorator implements Decorator { return Arrays.<Metric>asList(CoreMetrics.COMMENT_LINES_DENSITY, CoreMetrics.PUBLIC_DOCUMENTED_API_DENSITY); } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(Resource resource, DecoratorContext context) { saveCommentsDensity(context); savePublicApiDensity(context); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/DirectoriesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/DirectoriesDecorator.java index e7387bcc36b..84c6e7169c6 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/DirectoriesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/DirectoriesDecorator.java @@ -37,6 +37,7 @@ import java.util.Collection; */ public final class DirectoriesDecorator implements Decorator { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -49,6 +50,7 @@ public final class DirectoriesDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public void decorate(Resource resource, DecoratorContext context) { if (MeasureUtils.hasValue(context.getMeasure(CoreMetrics.DIRECTORIES))) { return; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java index d18e146fe53..5f0bfb3a2dc 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java @@ -51,6 +51,7 @@ public final class FileHashSensor implements Sensor { this.componentDataCache = componentDataCache; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FilesDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FilesDecorator.java index 0262de9c35b..67f16205b6b 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FilesDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FilesDecorator.java @@ -36,6 +36,7 @@ import java.util.Collection; */ public final class FilesDecorator implements Decorator { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -45,6 +46,7 @@ public final class FilesDecorator implements Decorator { return CoreMetrics.FILES; } + @Override public void decorate(Resource resource, DecoratorContext context) { if (MeasureUtils.hasValue(context.getMeasure(CoreMetrics.FILES))) { return; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java index 1f9c5728c9d..ce54b9bf4dc 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java @@ -43,10 +43,12 @@ public class ManualMeasureDecorator implements Decorator { this.metricFinder = metricFinder; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(Resource resource, DecoratorContext context) { if (resource.getId() != null) { List<ManualMeasure> manualMeasures = session.getResults(ManualMeasure.class, "resourceId", resource.getId()); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ProjectLinksSensor.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ProjectLinksSensor.java index c17eb331d6e..aef7a2153ad 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ProjectLinksSensor.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ProjectLinksSensor.java @@ -40,10 +40,12 @@ public class ProjectLinksSensor implements Sensor { this.defaultI18n = defaultI18n; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void analyse(Project project, SensorContext context) { handleLink(context, CoreProperties.LINKS_HOME_PAGE); handleLink(context, CoreProperties.LINKS_CI); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java index a79c13b6df1..3ad4eee62db 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/UnitTestDecorator.java @@ -41,6 +41,7 @@ public class UnitTestDecorator implements Decorator { return Arrays.<Metric>asList(CoreMetrics.TEST_EXECUTION_TIME, CoreMetrics.TESTS, CoreMetrics.TEST_ERRORS, CoreMetrics.TEST_FAILURES, CoreMetrics.TEST_SUCCESS_DENSITY); } + @Override public boolean shouldExecuteOnProject(Project project) { return !Project.AnalysisType.STATIC.equals(project.getAnalysisType()); } @@ -49,6 +50,7 @@ public class UnitTestDecorator implements Decorator { return ResourceUtils.isUnitTestClass(resource) || !ResourceUtils.isEntity(resource); } + @Override public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource)) { sumChildren(context, CoreMetrics.TEST_EXECUTION_TIME); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/VersionEventsSensor.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/VersionEventsSensor.java index 2babeeae13b..6a02a2065cc 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/VersionEventsSensor.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/VersionEventsSensor.java @@ -31,10 +31,12 @@ import java.util.Iterator; @DryRunIncompatible public class VersionEventsSensor implements Sensor { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void analyse(Project project, SensorContext context) { if (StringUtils.isBlank(project.getAnalysisVersion())) { return; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/AbstractNewCoverageFileAnalyzer.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/AbstractNewCoverageFileAnalyzer.java index 501a447b0a5..d7eec1da075 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/AbstractNewCoverageFileAnalyzer.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/AbstractNewCoverageFileAnalyzer.java @@ -76,6 +76,7 @@ public abstract class AbstractNewCoverageFileAnalyzer implements Decorator { public abstract Metric getNewUncoveredConditionsMetric(); + @Override public boolean shouldExecuteOnProject(Project project) { return !structs.isEmpty(); } @@ -96,6 +97,7 @@ public abstract class AbstractNewCoverageFileAnalyzer implements Decorator { return Arrays.asList(getNewLinesToCoverMetric(), getNewUncoveredLinesMetric(), getNewConditionsToCoverMetric(), getNewUncoveredConditionsMetric()); } + @Override public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorate(resource)) { doDecorate(context); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java index c23d303dbd2..70735e66566 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewCoverageAggregator.java @@ -38,6 +38,7 @@ import java.util.List; @DependedUpon(DecoratorBarriers.END_OF_TIME_MACHINE) public final class NewCoverageAggregator implements Decorator { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -50,6 +51,7 @@ public final class NewCoverageAggregator implements Decorator { CoreMetrics.NEW_OVERALL_LINES_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER, CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS); } + @Override public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorate(resource)) { int maxPeriods = Qualifiers.isView(resource, true) ? 3 : 5; diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java index 81e06451e24..0bbe4badd2f 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyDecorator.java @@ -94,10 +94,12 @@ public class TendencyDecorator implements Decorator { return query; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource)) { resetQuery(context.getProject(), resource); diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java index 1b2a70c1c3f..4b8a0225162 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java @@ -46,6 +46,7 @@ public final class TimeMachineConfigurationPersister implements Decorator { this.session = session; } + @Override public void decorate(Resource resource, DecoratorContext context) { if (ResourceUtils.isProject(resource)) { persistConfiguration(); @@ -63,6 +64,7 @@ public final class TimeMachineConfigurationPersister implements Decorator { session.commit(); } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java index 5d08e83cd93..dc6cab324c7 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/VariationDecorator.java @@ -67,6 +67,7 @@ public class VariationDecorator implements Decorator { this.ruleFinder = ruleFinder; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -76,6 +77,7 @@ public class VariationDecorator implements Decorator { return pastMeasuresLoader.getMetrics(); } + @Override public void decorate(Resource resource, DecoratorContext context) { for (PastSnapshot projectPastSnapshot : projectPastSnapshots) { if (shouldComputeVariation(resource)) { diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java index 2aabbd85918..f01a23a57cc 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CoreWidget.java @@ -31,10 +31,12 @@ public abstract class CoreWidget extends AbstractRubyTemplate implements RubyRai this.templatePath = templatePath; } + @Override public String getId() { return id; } + @Override public String getTitle() { return title; } diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java index 9b922e17f20..2abed6cd61b 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java @@ -33,6 +33,7 @@ import java.util.List; public final class CpdPlugin extends SonarPlugin { + @Override public List getExtensions() { return ImmutableList.of( PropertyDefinition.builder(CoreProperties.CPD_CROSS_PROJECT) diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/JavaCpdEngine.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/JavaCpdEngine.java index fb128eddcc9..cf74b2cab7f 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/JavaCpdEngine.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/JavaCpdEngine.java @@ -183,6 +183,7 @@ public class JavaCpdEngine extends CpdEngine { this.fileBlocks = fileBlocks; } + @Override public List<CloneGroup> call() { return SuffixTreeCloneDetectionAlgorithm.detect(index, fileBlocks); } diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java index bea536ce8d0..c5208cf2a7f 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/decorators/DuplicationDensityDecorator.java @@ -48,10 +48,12 @@ public class DuplicationDensityDecorator implements Decorator { return CoreMetrics.DUPLICATED_LINES_DENSITY; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(Resource resource, DecoratorContext context) { Measure nbDuplicatedLines = context.getMeasure(CoreMetrics.DUPLICATED_LINES); if (nbDuplicatedLines == null) { diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/SonarDuplicationsIndex.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/SonarDuplicationsIndex.java index d1f89d8332c..ad8ac293527 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/SonarDuplicationsIndex.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/SonarDuplicationsIndex.java @@ -59,6 +59,7 @@ public class SonarDuplicationsIndex extends AbstractCloneIndex { return mem.getByResourceId(resourceKey); } + @Override public Collection<Block> getBySequenceHash(ByteArray hash) { if (db == null) { return mem.getBySequenceHash(hash); @@ -69,10 +70,12 @@ public class SonarDuplicationsIndex extends AbstractCloneIndex { } } + @Override public Collection<Block> getByResourceId(String resourceId) { throw new UnsupportedOperationException(); } + @Override public void insert(Block block) { throw new UnsupportedOperationException(); } diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java index d8c6cdcdab5..01397e6be89 100644 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java +++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java @@ -33,6 +33,7 @@ import java.util.List; public final class DbCleanerPlugin extends SonarPlugin { + @Override public List getExtensions() { return ImmutableList.builder().add(DefaultPeriodCleaner.class, DefaultPurgeTask.class, ProjectPurgePostJob.class) .addAll(propertyDefinitions()).build(); diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java index 72f28d21e9a..5636515cb3e 100644 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java +++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DefaultPurgeTask.java @@ -50,11 +50,13 @@ public class DefaultPurgeTask implements PurgeTask { this.profiler = profiler; } + @Override public PurgeTask delete(long resourceId) { purgeDao.deleteResourceTree(resourceId); return this; } + @Override public PurgeTask purge(long resourceId) { long start = System.currentTimeMillis(); profiler.reset(); diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/ProjectPurgePostJob.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/ProjectPurgePostJob.java index 7251822afec..1a412bcda8a 100644 --- a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/ProjectPurgePostJob.java +++ b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/ProjectPurgePostJob.java @@ -34,6 +34,7 @@ public class ProjectPurgePostJob implements PostJob { this.purgeTask = purgeTask; } + @Override public void executeOn(final Project project, SensorContext context) { purgeTask.purge(project.getId()); } diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java index ddd9a536dd6..4d0738def07 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java @@ -25,6 +25,7 @@ import org.sonar.api.SonarPlugin; import java.util.List; public class EmailNotificationsPlugin extends SonarPlugin { + @Override public List getExtensions() { return ImmutableList.of( EmailNotificationChannel.class, diff --git a/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitBlameConsumer.java b/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitBlameConsumer.java index 837c54230f7..350d3dd956f 100644 --- a/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitBlameConsumer.java +++ b/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitBlameConsumer.java @@ -63,6 +63,7 @@ public class GitBlameConsumer implements StreamConsumer { this.filename = filename; } + @Override public void consumeLine(String line) { if (line == null) { return; diff --git a/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitPlugin.java b/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitPlugin.java index 262fa7ecebd..e6141fe4fae 100644 --- a/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitPlugin.java +++ b/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/GitPlugin.java @@ -34,6 +34,7 @@ public final class GitPlugin extends SonarPlugin { static final String JGIT = "jgit"; static final String EXE = "exe"; + @Override public List getExtensions() { return ImmutableList.of( GitScmProvider.class, diff --git a/plugins/sonar-l10n-en-plugin/src/main/java/org/sonar/plugins/l10n/EnglishPackPlugin.java b/plugins/sonar-l10n-en-plugin/src/main/java/org/sonar/plugins/l10n/EnglishPackPlugin.java index 8409d7253cb..f5ddb9b924e 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/java/org/sonar/plugins/l10n/EnglishPackPlugin.java +++ b/plugins/sonar-l10n-en-plugin/src/main/java/org/sonar/plugins/l10n/EnglishPackPlugin.java @@ -27,6 +27,7 @@ import java.util.List; public final class EnglishPackPlugin extends SonarPlugin { + @Override public List getExtensions() { return Collections.emptyList(); } diff --git a/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java b/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java index f6b462839b9..48b65ffee6d 100644 --- a/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java +++ b/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java @@ -83,6 +83,7 @@ public class SvnBlameCommand implements BlameCommand, BatchComponent { private Future<Void> submitTask(final FileSystem fs, final BlameResult result, ExecutorService executorService, final InputFile inputFile) { return executorService.submit(new Callable<Void>() { + @Override public Void call() { blame(fs, inputFile, result); return null; diff --git a/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnPlugin.java b/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnPlugin.java index d8815d8dd60..d001cd8fd39 100644 --- a/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnPlugin.java +++ b/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnPlugin.java @@ -27,6 +27,7 @@ import java.util.List; public final class SvnPlugin extends SonarPlugin { + @Override public List getExtensions() { List result = new ArrayList(); result.addAll(ImmutableList.of( diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentsFinderSort.java b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentsFinderSort.java index 88b30b84941..6308e4d3630 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentsFinderSort.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentsFinderSort.java @@ -70,6 +70,7 @@ class ComponentsFinderSort { @Override Function sortFieldFunction() { return new Function<Component, String>() { + @Override public String apply(Component component) { return sortField(component); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java index 7e4d49124d5..8e953b66774 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java @@ -110,6 +110,7 @@ public class ComponentDao extends BaseDao<ComponentMapper, ComponentDto, String> return components; } + @Override protected List<ComponentDto> doGetByKeys(DbSession session, Collection<String> keys) { return mapper(session).findByKeys(keys); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java index 4a8bbe00dd6..461f3d3a275 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java @@ -152,11 +152,13 @@ public abstract class BaseDao<MAPPER, DTO extends Dto<KEY>, KEY extends Serializ return session.getMapper(mapperClass); } + @Override @CheckForNull public DTO getNullableByKey(DbSession session, KEY key) { return doGetNullableByKey(session, key); } + @Override public DTO getByKey(DbSession session, KEY key) { DTO value = doGetNullableByKey(session, key); if (value == null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java index db4cd78bbe4..d8817bd40d6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java @@ -45,10 +45,12 @@ public class DebtModelService implements DebtModel { this.debtModelBackup = debtModelBackup; } + @Override public List<DebtCharacteristic> characteristics() { return debtModelLookup.rootCharacteristics(); } + @Override public List<DebtCharacteristic> allCharacteristics() { return debtModelLookup.allCharacteristics(); } @@ -58,6 +60,7 @@ public class DebtModelService implements DebtModel { return debtModelLookup.characteristicById(id); } + @Override @CheckForNull public DebtCharacteristic characteristicByKey(String key) { return debtModelLookup.characteristicByKey(key); diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java index 4186a464672..e5b794a9994 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java @@ -239,6 +239,7 @@ public class DebtModelXMLExporter implements ServerComponent { private List<DebtCharacteristic> sortByOrder(List<DebtCharacteristic> characteristics) { Collections.sort(characteristics, new Ordering<DebtCharacteristic>() { + @Override public int compare(@Nullable DebtCharacteristic left, @Nullable DebtCharacteristic right) { if (left == null || left.order() == null || right == null || right.order() == null) { return -1; @@ -251,6 +252,7 @@ public class DebtModelXMLExporter implements ServerComponent { private List<DebtCharacteristic> sortByName(List<DebtCharacteristic> characteristics) { Collections.sort(characteristics, new Ordering<DebtCharacteristic>() { + @Override public int compare(@Nullable DebtCharacteristic left, @Nullable DebtCharacteristic right) { if (left == null || right == null) { return -1; diff --git a/server/sonar-server/src/main/java/org/sonar/server/design/FileDesignWidget.java b/server/sonar-server/src/main/java/org/sonar/server/design/FileDesignWidget.java index 219a20a8e4e..18930483742 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/design/FileDesignWidget.java +++ b/server/sonar-server/src/main/java/org/sonar/server/design/FileDesignWidget.java @@ -28,10 +28,12 @@ import org.sonar.api.web.WidgetCategory; @WidgetCategory({"Design"}) public final class FileDesignWidget extends AbstractRubyTemplate implements RubyRailsWidget { + @Override public String getId() { return "file_design"; } + @Override public String getTitle() { return "File design"; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/design/PackageDesignWidget.java b/server/sonar-server/src/main/java/org/sonar/server/design/PackageDesignWidget.java index 4d981e17a9d..2768b49f2c8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/design/PackageDesignWidget.java +++ b/server/sonar-server/src/main/java/org/sonar/server/design/PackageDesignWidget.java @@ -28,10 +28,12 @@ import org.sonar.api.web.WidgetCategory; @WidgetCategory({"Design"}) public final class PackageDesignWidget extends AbstractRubyTemplate implements RubyRailsWidget { + @Override public String getId() { return "package_design"; } + @Override public String getTitle() { return "File design"; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssuesFinderSort.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssuesFinderSort.java index 937bf337896..25cc9622745 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssuesFinderSort.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssuesFinderSort.java @@ -87,6 +87,7 @@ class IssuesFinderSort { @Override Function sortFieldFunction() { return new Function<IssueDto, String>() { + @Override public String apply(IssueDto issueDto) { return sortField(issueDto); } @@ -123,6 +124,7 @@ class IssuesFinderSort { @Override Function sortFieldFunction() { return new Function<IssueDto, Integer>() { + @Override public Integer apply(IssueDto issueDto) { return Severity.ALL.indexOf(issueDto.getSeverity()); } @@ -143,6 +145,7 @@ class IssuesFinderSort { @Override Function sortFieldFunction() { return new Function<IssueDto, Date>() { + @Override public Date apply(IssueDto issueDto) { return sortField(issueDto); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java index 5bb41739273..a261dd3e888 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java @@ -42,6 +42,7 @@ public class ServerIssueStorage extends IssueStorage implements ServerComponent this.dbClient = dbClient; } + @Override protected void doInsert(DbSession session, Date now, DefaultIssue issue) { long componentId = componentId(session, issue); long projectId = projectId(session, issue); @@ -51,6 +52,7 @@ public class ServerIssueStorage extends IssueStorage implements ServerComponent dbClient.issueDao().insert(session, dto); } + @Override protected void doUpdate(DbSession session, Date now, DefaultIssue issue) { IssueDto dto = IssueDto.toDtoForUpdate(issue, projectId(session, issue), now); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/db/IssueDao.java b/server/sonar-server/src/main/java/org/sonar/server/issue/db/IssueDao.java index df3dec2284c..bd38edb6da7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/db/IssueDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/db/IssueDao.java @@ -52,6 +52,7 @@ public class IssueDao extends BaseDao<IssueMapper, IssueDto, String> implements return mapper(session).selectByKey(key); } + @Override protected List<IssueDto> doGetByKeys(DbSession session, Collection<String> keys) { return mapper(session).selectByKeys(keys); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java index 17415cab3c0..26f1b337f53 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java @@ -244,20 +244,24 @@ class MeasureFilterSql { } static class TextSortRowProcessor extends RowProcessor { + @Override MeasureFilterRow fetch(ResultSet rs) throws SQLException { MeasureFilterRow row = new MeasureFilterRow(rs.getLong(1), rs.getLong(2), rs.getLong(3)); row.setSortText(rs.getString(4)); return row; } + @Override Function sortFieldFunction() { return new Function<MeasureFilterRow, String>() { + @Override public String apply(MeasureFilterRow row) { return row.getSortText(); } }; } + @Override Ordering sortFieldOrdering(boolean ascending) { Ordering<String> ordering = Ordering.from(String.CASE_INSENSITIVE_ORDER); if (!ascending) { @@ -268,8 +272,10 @@ class MeasureFilterSql { } static class AlertSortRowProcessor extends TextSortRowProcessor { + @Override Function sortFieldFunction() { return new Function<MeasureFilterRow, Integer>() { + @Override public Integer apply(MeasureFilterRow row) { return ImmutableList.of("OK", "WARN", "ERROR").indexOf(row.getSortText()); } @@ -287,6 +293,7 @@ class MeasureFilterSql { } static class NumericSortRowProcessor extends RowProcessor { + @Override MeasureFilterRow fetch(ResultSet rs) throws SQLException { MeasureFilterRow row = new MeasureFilterRow(rs.getLong(1), rs.getLong(2), rs.getLong(3)); double value = rs.getDouble(4); @@ -296,34 +303,41 @@ class MeasureFilterSql { return row; } + @Override Function sortFieldFunction() { return new Function<MeasureFilterRow, Double>() { + @Override public Double apply(MeasureFilterRow row) { return row.getSortDouble(); } }; } + @Override Ordering sortFieldOrdering(boolean ascending) { return ascending ? Ordering.natural().nullsLast() : Ordering.natural().reverse().nullsLast(); } } static class DateSortRowProcessor extends RowProcessor { + @Override MeasureFilterRow fetch(ResultSet rs) throws SQLException { MeasureFilterRow row = new MeasureFilterRow(rs.getLong(1), rs.getLong(2), rs.getLong(3)); row.setSortDate(rs.getTimestamp(4)); return row; } + @Override Function sortFieldFunction() { return new Function<MeasureFilterRow, Timestamp>() { + @Override public Timestamp apply(MeasureFilterRow row) { return row.getSortDate(); } }; } + @Override Ordering sortFieldOrdering(boolean ascending) { return newObjectOrdering(ascending); } @@ -332,6 +346,7 @@ class MeasureFilterSql { private static Ordering newObjectOrdering(boolean ascending) { if (ascending) { return Ordering.from(new Comparator<Comparable>() { + @Override public int compare(@Nullable Comparable left, @Nullable Comparable right) { if (left == null) { return 1; @@ -345,6 +360,7 @@ class MeasureFilterSql { }); } return Ordering.from(new Comparator<Comparable>() { + @Override public int compare(@Nullable Comparable left, @Nullable Comparable right) { if (left == null) { return 1; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ManualMeasuresWs.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ManualMeasuresWs.java index 553efe1f5cd..66337c24d3a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ManualMeasuresWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ManualMeasuresWs.java @@ -25,6 +25,7 @@ import org.sonar.api.server.ws.WebService; public class ManualMeasuresWs implements WebService { + @Override public void define(Context context) { NewController controller = context.createController("api/manual_measures"); controller.setDescription("Manual measures management"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java index 220b54947a4..9843013dbed 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java @@ -100,6 +100,7 @@ public class NotificationService implements ServerComponent { public void start() { executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleWithFixedDelay(new Runnable() { + @Override public void run() { try { processQueue(); @@ -167,10 +168,12 @@ public class NotificationService implements ServerComponent { final SetMultimap<String, NotificationChannel> recipients = HashMultimap.create(); for (NotificationDispatcher dispatcher : dispatchers) { NotificationDispatcher.Context context = new NotificationDispatcher.Context() { + @Override public void addUser(String username) { // This method is not used anymore } + @Override public void addUser(String userLogin, NotificationChannel notificationChannel) { if (userLogin != null) { recipients.put(userLogin, notificationChannel); diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java index 0e8acf3757f..d9d0f57d3e3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java @@ -71,6 +71,7 @@ class ClassLoaderUtils { */ static Collection<String> listFiles(ClassLoader classLoader, String rootPath) { return listResources(classLoader, rootPath, new Predicate<String>() { + @Override public boolean apply(@Nullable String path) { return !StringUtils.endsWith(path, "/"); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/PlatformServletContextListener.java b/server/sonar-server/src/main/java/org/sonar/server/platform/PlatformServletContextListener.java index e4da105f046..4e4a220bf13 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/PlatformServletContextListener.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/PlatformServletContextListener.java @@ -30,6 +30,7 @@ import java.util.Properties; public final class PlatformServletContextListener implements ServletContextListener { + @Override public void contextInitialized(ServletContextEvent event) { try { Properties props = new Properties(); @@ -59,6 +60,7 @@ public final class PlatformServletContextListener implements ServletContextListe } } + @Override public void contextDestroyed(ServletContextEvent event) { Platform.getInstance().doStop(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java b/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java index af91a4bad92..9b6aa28c4d7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java @@ -90,6 +90,7 @@ public class RailsAppsDeployer implements Startable { LOG.info("Deploy app: " + pluginKey); File appDir = new File(appsDir, pluginKey); ClassLoaderUtils.copyResources(appClassLoader, pathToRubyInitFile(pluginKey), appDir, new Function<String, String>() { + @Override public String apply(@Nullable String relativePath) { // Relocate the deployed files : // relativePath format is: org/sonar/ror/sqale/app/controllers/foo_controller.rb diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginJarInstaller.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginJarInstaller.java index 12d1566c183..777a197defd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginJarInstaller.java +++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginJarInstaller.java @@ -54,6 +54,7 @@ public class ServerPluginJarInstaller extends PluginJarInstaller { } private static final class LibFilter implements ZipUtils.ZipEntryFilter { + @Override public boolean accept(ZipEntry entry) { return entry.getName().startsWith("META-INF/lib"); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActivity.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActivity.java index 167beb1b4fa..8b294dfa62f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActivity.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileActivity.java @@ -75,6 +75,7 @@ public class QProfileActivity extends ActivityDoc implements Activity { return RuleKey.parse((String) getField("ruleKey")); } + @Override @CheckForNull public String login() { return getNullableField(ActivityNormalizer.LogFields.LOGIN.field()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java index 1695a08590a..7139554e54c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java @@ -184,6 +184,7 @@ public class RegisterQualityProfiles implements ServerComponent { private static Map<String, Collection<RulesProfile>> profilesByName(List<RulesProfile> profiles) { return Multimaps.index(profiles, new Function<RulesProfile, String>() { + @Override public String apply(@Nullable RulesProfile profile) { return profile != null ? profile.getName() : null; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java b/server/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java index 66f0990d3db..ab781bba378 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/DefaultRuleFinder.java @@ -50,6 +50,7 @@ public class DefaultRuleFinder implements RuleFinder { this.index = indexes.get(RuleIndex.class); } + @Override @CheckForNull public org.sonar.api.rules.Rule findById(int ruleId) { Rule rule = index.getById(ruleId); @@ -81,6 +82,7 @@ public class DefaultRuleFinder implements RuleFinder { return rules; } + @Override @CheckForNull public org.sonar.api.rules.Rule findByKey(RuleKey key) { Rule rule = index.getNullableByKey(key); @@ -91,11 +93,13 @@ public class DefaultRuleFinder implements RuleFinder { } } + @Override @CheckForNull public org.sonar.api.rules.Rule findByKey(String repositoryKey, String key) { return findByKey(RuleKey.of(repositoryKey, key)); } + @Override public final org.sonar.api.rules.Rule find(org.sonar.api.rules.RuleQuery query) { Result<Rule> result = index.search(toQuery(query), new QueryContext()); if (!result.getHits().isEmpty()) { @@ -105,6 +109,7 @@ public class DefaultRuleFinder implements RuleFinder { } } + @Override public final Collection<org.sonar.api.rules.Rule> findAll(org.sonar.api.rules.RuleQuery query) { List<org.sonar.api.rules.Rule> rules = newArrayList(); for (Rule rule : index.search(toQuery(query), new QueryContext()).getHits()) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java index 9d49c9d4f31..bd79dc359cd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java @@ -76,6 +76,7 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> { super(IndexDefinition.RULE, normalizer, client); } + @Override protected String getKeyValue(RuleKey key) { return key.toString(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java b/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java index e071068a772..d9db7ad82c4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java @@ -86,6 +86,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial this.indexDefinition = indexDefinition; } + @Override public BaseNormalizer<DTO, KEY> getNormalizer() { return normalizer; } @@ -118,6 +119,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial } // Scrolling within the index + @Override public Iterator<DOMAIN> scroll(final String scrollId) { return new Iterator<DOMAIN>() { @@ -185,6 +187,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial } } + @Override public IndexStat getIndexStat() { IndexStat stat = new IndexStat(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/text/RuleMacro.java b/server/sonar-server/src/main/java/org/sonar/server/text/RuleMacro.java index d9c0f4e2b7f..82c0186c386 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/text/RuleMacro.java +++ b/server/sonar-server/src/main/java/org/sonar/server/text/RuleMacro.java @@ -31,10 +31,12 @@ class RuleMacro implements Macro { /** * First parameter is the repository, second one is the rule key. Exemple : {rule:squid:ArchitecturalConstraint} */ + @Override public String getRegex() { return "\\{rule:([a-zA-Z0-9._-]++):([a-zA-Z0-9._-]++)\\}"; } + @Override public String getReplacement() { return "<a href='" + contextPath + "/coding_rules#rule_key=$1:$2'>$2</a>"; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java b/server/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java index 07e5d9eed7c..a36b8792e41 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java @@ -334,6 +334,7 @@ public class ViewProxy<V extends View> implements Comparable<ViewProxy> { } + @Override public int compareTo(ViewProxy other) { return new CompareToBuilder() .append(getTitle(), other.getTitle()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/ListingWs.java b/server/sonar-server/src/main/java/org/sonar/server/ws/ListingWs.java index 5329674fb50..637c1d8ded0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ws/ListingWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ws/ListingWs.java @@ -124,6 +124,7 @@ public class ListingWs implements WebService { // sort controllers by path Ordering<Controller> ordering = Ordering.natural().onResultOf(new Function<Controller, String>() { + @Override public String apply(Controller controller) { return controller.path(); } @@ -144,6 +145,7 @@ public class ListingWs implements WebService { writer.prop("description", controller.description()); // sort actions by key Ordering<Action> ordering = Ordering.natural().onResultOf(new Function<Action, String>() { + @Override public String apply(Action action) { return action.key(); } @@ -169,6 +171,7 @@ public class ListingWs implements WebService { if (!action.params().isEmpty()) { // sort parameters by key Ordering<Param> ordering = Ordering.natural().onResultOf(new Function<Param, String>() { + @Override public String apply(@Nullable Param param) { return param != null ? param.key() : null; } diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultActionPlan.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultActionPlan.java index 8e12f27479a..26730eafc47 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultActionPlan.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultActionPlan.java @@ -40,23 +40,28 @@ public class DefaultActionPlan implements ActionPlan { /** * Unique key */ + @Override public String key() { return JsonUtils.getString(json, "key"); } + @Override public String project() { return JsonUtils.getString(json, "project"); } + @Override public String name() { return JsonUtils.getString(json, "name"); } + @Override @CheckForNull public String description() { return JsonUtils.getString(json, "desc"); } + @Override public String status() { return JsonUtils.getString(json, "status"); } @@ -64,28 +69,34 @@ public class DefaultActionPlan implements ActionPlan { /** * Login of the user who created the action plan. */ + @Override public String userLogin() { return JsonUtils.getString(json, "userLogin"); } + @Override @CheckForNull public Date deadLine() { return JsonUtils.getDateTime(json, "deadLine"); } + @Override public Date createdAt() { return JsonUtils.getDateTime(json, "createdAt"); } + @Override public Date updatedAt() { return JsonUtils.getDateTime(json, "updatedAt"); } + @Override @CheckForNull public Integer totalIssues() { return JsonUtils.getInteger(json, "totalIssues"); } + @Override @CheckForNull public Integer unresolvedIssues() { return JsonUtils.getInteger(json, "unresolvedIssues"); diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java index 9ce9b5e3c08..62f9c9562c7 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultBulkChange.java @@ -36,15 +36,18 @@ public class DefaultBulkChange implements BulkChange { private Integer totalIssuesNotChanged; private final List<String> issuesNotChangedKeys = new ArrayList<String>(); + @Override public List<String> issuesNotChangedKeys() { return issuesNotChangedKeys; } + @Override @CheckForNull public Integer totalIssuesChanged() { return totalIssuesChanged; } + @Override @CheckForNull public Integer totalIssuesNotChanged() { return totalIssuesNotChanged; diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java index a86f9e35cbd..4492c919ab5 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java @@ -41,45 +41,55 @@ public class DefaultIssue implements Issue { /** * Unique key */ + @Override public String key() { return JsonUtils.getString(json, "key"); } + @Override public Long componentId() { return JsonUtils.getLong(json, "componentId"); } + @Override public String componentKey() { return JsonUtils.getString(json, "component"); } + @Override public String projectKey() { return JsonUtils.getString(json, "project"); } + @Override public String ruleKey() { return JsonUtils.getString(json, "rule"); } + @Override public String severity() { return JsonUtils.getString(json, "severity"); } + @Override @CheckForNull public String message() { return JsonUtils.getString(json, "message"); } + @Override @CheckForNull public Integer line() { return JsonUtils.getInteger(json, "line"); } + @Override @CheckForNull public String debt() { return JsonUtils.getString(json, "debt"); } + @Override public String status() { return JsonUtils.getString(json, "status"); } @@ -87,11 +97,13 @@ public class DefaultIssue implements Issue { /** * The resolution type. Null if the issue is not resolved. */ + @Override @CheckForNull public String resolution() { return JsonUtils.getString(json, "resolution"); } + @Override @CheckForNull public String reporter() { return JsonUtils.getString(json, "reporter"); @@ -100,6 +112,7 @@ public class DefaultIssue implements Issue { /** * Login of assignee. Null if issue is not assigned. */ + @Override @CheckForNull public String assignee() { return JsonUtils.getString(json, "assignee"); @@ -108,34 +121,41 @@ public class DefaultIssue implements Issue { /** * SCM account */ + @Override @CheckForNull public String author() { return JsonUtils.getString(json, "author"); } + @Override @CheckForNull public String actionPlan() { return JsonUtils.getString(json, "actionPlan"); } + @Override public Date creationDate() { return JsonUtils.getDateTime(json, "creationDate"); } + @Override public Date updateDate() { return JsonUtils.getDateTime(json, "updateDate"); } + @Override @CheckForNull public Date closeDate() { return JsonUtils.getDateTime(json, "closeDate"); } + @Override @CheckForNull public String attribute(String key) { return attributes().get(key); } + @Override public Map<String, String> attributes() { Map<String, String> attr = (Map<String, String>) json.get("attr"); if (attr == null) { @@ -147,6 +167,7 @@ public class DefaultIssue implements Issue { /** * Non-null list of comments */ + @Override public List<IssueComment> comments() { List<IssueComment> comments = new ArrayList<IssueComment>(); List<Map> jsonComments = (List<Map>) json.get("comments"); diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChange.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChange.java index 42b5285645c..b7e7ecf6626 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChange.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChange.java @@ -39,14 +39,17 @@ public class DefaultIssueChange implements IssueChange { this.json = json; } + @Override public String user() { return JsonUtils.getString(json, "user"); } + @Override public Date creationDate() { return JsonUtils.getDateTime(json, "creationDate"); } + @Override public List<IssueChangeDiff> diffs() { List<IssueChangeDiff> diffs = new ArrayList<IssueChangeDiff>(); List<Map> jsonDiffs = (List<Map>) json.get("diffs"); diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java index c2273701b43..e74b7c17cf6 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java @@ -37,16 +37,19 @@ public class DefaultIssueChangeDiff implements IssueChangeDiff { this.json = json; } + @Override public String key() { return JsonUtils.getString(json, "key"); } + @Override @CheckForNull public Object newValue() { return parseValue("newValue"); } + @Override @CheckForNull public Object oldValue() { return parseValue("oldValue"); diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueClient.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueClient.java index e37a111fffd..024f5dd0e0a 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueClient.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueClient.java @@ -45,6 +45,7 @@ public class DefaultIssueClient implements IssueClient { this.parser = new IssueJsonParser(); } + @Override public Issues find(IssueQuery query) { String json = requestFactory.get(SEARCH_URL, query.urlParams()); return parser.parseIssues(json); diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueComment.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueComment.java index 7b89aef9ab1..103bb942773 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueComment.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueComment.java @@ -35,18 +35,22 @@ public class DefaultIssueComment implements IssueComment { this.json = json; } + @Override public String key() { return JsonUtils.getString(json, "key"); } + @Override public String htmlText() { return JsonUtils.getString(json, "htmlText"); } + @Override public String login() { return JsonUtils.getString(json, "login"); } + @Override public Date createdAt() { return JsonUtils.getDateTime(json, "createdAt"); } diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java index 39e5ecbfffb..cfacd6111a0 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssues.java @@ -47,72 +47,88 @@ public class DefaultIssues implements Issues { private Paging paging; private Boolean maxResultsReached; + @Override public List<Issue> list() { return list; } + @Override public int size() { return list.size(); } + @Override public Collection<Rule> rules() { return rulesByKey.values(); } + @Override public Rule rule(Issue issue) { return rulesByKey.get(issue.ruleKey()); } + @Override public Collection<User> users() { return usersByKey.values(); } + @Override @CheckForNull public User user(String login) { return usersByKey.get(login); } + @Override public Collection<Component> components() { return componentsByKey.values(); } + @Override @CheckForNull public Component component(Issue issue) { return componentsByKey.get(issue.componentKey()); } + @Override @CheckForNull public Component componentById(long id) { return componentsById.get(id); } + @Override @CheckForNull public Component componentByKey(String key) { return componentsByKey.get(key); } + @Override public Collection<Component> projects() { return projectsByKey.values(); } + @Override @CheckForNull public Component project(Issue issue) { return projectsByKey.get(issue.projectKey()); } + @Override public Collection<ActionPlan> actionPlans() { return actionPlansByKey.values(); } + @Override @CheckForNull public ActionPlan actionPlans(Issue issue) { return actionPlansByKey.get(issue.actionPlan()); } + @Override public Paging paging() { return paging; } + @Override @Nullable public Boolean maxResultsReached() { return maxResultsReached; diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java index 1a4c2abe4c2..db0918e4146 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AbstractUnmarshaller.java @@ -27,6 +27,7 @@ import java.util.List; public abstract class AbstractUnmarshaller<M extends Model> implements Unmarshaller<M> { + @Override public final M toModel(String json) { WSUtils utils = WSUtils.getINSTANCE(); M result = null; @@ -45,6 +46,7 @@ public abstract class AbstractUnmarshaller<M extends Model> implements Unmarshal } + @Override public final List<M> toModels(String json) { WSUtils utils = WSUtils.getINSTANCE(); List<M> result = new ArrayList<M>(); diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AuthenticationUnmarshaller.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AuthenticationUnmarshaller.java index 6be57d09231..fd9d3a2fe7a 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AuthenticationUnmarshaller.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/AuthenticationUnmarshaller.java @@ -26,6 +26,7 @@ import java.util.List; public class AuthenticationUnmarshaller implements Unmarshaller<Authentication> { + @Override public Authentication toModel(String json) { WSUtils utils = WSUtils.getINSTANCE(); Object map = utils.parse(json); @@ -34,6 +35,7 @@ public class AuthenticationUnmarshaller implements Unmarshaller<Authentication> return new Authentication().setValid(validJson != null ? validJson : false); } + @Override public List<Authentication> toModels(String json) { throw new UnsupportedOperationException(); } diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java index ae72b1324a9..318a88594d6 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshaller.java @@ -28,6 +28,7 @@ import java.util.List; * @since 2.9 */ public class ServerSetupUnmarshaller implements Unmarshaller<ServerSetup> { + @Override public ServerSetup toModel(String json) { WSUtils utils = WSUtils.getINSTANCE(); Object map = utils.parse(json); @@ -36,6 +37,7 @@ public class ServerSetupUnmarshaller implements Unmarshaller<ServerSetup> { .setMessage(utils.getString(map, "msg")); } + @Override public List<ServerSetup> toModels(String json) { throw new UnsupportedOperationException(); } diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerUnmarshaller.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerUnmarshaller.java index 0951e2d28d3..0949eaadf25 100644 --- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerUnmarshaller.java +++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ServerUnmarshaller.java @@ -28,6 +28,7 @@ import java.util.List; * @author Evgeny Mandrikov */ public class ServerUnmarshaller implements Unmarshaller<Server> { + @Override public Server toModel(String json) { WSUtils utils = WSUtils.getINSTANCE(); Object map = utils.parse(json); @@ -42,6 +43,7 @@ public class ServerUnmarshaller implements Unmarshaller<Server> { return server; } + @Override public List<Server> toModels(String json) { throw new UnsupportedOperationException(); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java index 33172ca4aaa..eb8174abb0d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java @@ -86,10 +86,12 @@ public class DefaultDecoratorContext implements DecoratorContext { return this; } + @Override public Project getProject() { return sonarIndex.getProject(); } + @Override public List<DecoratorContext> getChildren() { checkReadOnly("getModules"); return childrenContexts; @@ -101,6 +103,7 @@ public class DefaultDecoratorContext implements DecoratorContext { } } + @Override public <M> M getMeasures(MeasuresFilter<M> filter) { Collection<Measure> unfiltered; if (filter instanceof MeasuresFilters.MetricFilter) { @@ -112,10 +115,12 @@ public class DefaultDecoratorContext implements DecoratorContext { return filter.filter(unfiltered); } + @Override public Measure getMeasure(Metric metric) { return getMeasures(MeasuresFilters.metric(metric)); } + @Override public Collection<Measure> getChildrenMeasures(MeasuresFilter filter) { List<Measure> result = Lists.newArrayList(); for (DecoratorContext childContext : childrenContexts) { @@ -131,14 +136,17 @@ public class DefaultDecoratorContext implements DecoratorContext { return result; } + @Override public Collection<Measure> getChildrenMeasures(Metric metric) { return getChildrenMeasures(MeasuresFilters.metric(metric)); } + @Override public Resource getResource() { return resource; } + @Override public DecoratorContext saveMeasure(Measure measure) { checkReadOnly(SAVE_MEASURE_METHOD); Metric metric = metricFinder.findByKey(measure.getMetricKey()); @@ -167,6 +175,7 @@ public class DefaultDecoratorContext implements DecoratorContext { return this; } + @Override public DecoratorContext saveMeasure(Metric metric, Double value) { checkReadOnly(SAVE_MEASURE_METHOD); saveMeasure(new Measure(metric, value)); @@ -176,6 +185,7 @@ public class DefaultDecoratorContext implements DecoratorContext { /** * {@inheritDoc} */ + @Override public List<Violation> getViolations(ViolationQuery violationQuery) { return sonarIndex.getViolations(violationQuery); } @@ -183,39 +193,48 @@ public class DefaultDecoratorContext implements DecoratorContext { /** * {@inheritDoc} */ + @Override public List<Violation> getViolations() { return sonarIndex.getViolations(resource); } + @Override public Dependency saveDependency(Dependency dependency) { checkReadOnly("addDependency"); return sonarIndex.addDependency(dependency); } + @Override public Set<Dependency> getDependencies() { return sonarIndex.getDependencies(); } + @Override public Collection<Dependency> getIncomingDependencies() { return sonarIndex.getIncomingEdges(resource); } + @Override public Collection<Dependency> getOutgoingDependencies() { return sonarIndex.getOutgoingEdges(resource); } + @Override public List<Event> getEvents() { return sonarIndex.getEvents(resource); } + @Override public Event createEvent(String name, String description, String category, Date date) { return sonarIndex.addEvent(resource, name, description, category, date); } + @Override public void deleteEvent(Event event) { sonarIndex.deleteEvent(event); } + @Override public DefaultDecoratorContext saveViolation(Violation violation, boolean force) { if (violation.getResource() == null) { violation.setResource(resource); @@ -224,6 +243,7 @@ public class DefaultDecoratorContext implements DecoratorContext { return this; } + @Override public DefaultDecoratorContext saveViolation(Violation violation) { return saveViolation(violation, false); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultFileLinesContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultFileLinesContext.java index 98c5ef1dc78..df46490c7af 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultFileLinesContext.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultFileLinesContext.java @@ -52,6 +52,7 @@ public class DefaultFileLinesContext implements FileLinesContext { this.resource = resource; } + @Override public void setIntValue(String metricKey, int line, int value) { Preconditions.checkNotNull(metricKey); Preconditions.checkArgument(line > 0); @@ -59,6 +60,7 @@ public class DefaultFileLinesContext implements FileLinesContext { setValue(metricKey, line, value); } + @Override public Integer getIntValue(String metricKey, int line) { Preconditions.checkNotNull(metricKey); Preconditions.checkArgument(line > 0); @@ -72,6 +74,7 @@ public class DefaultFileLinesContext implements FileLinesContext { return (Integer) lines.get(line); } + @Override public void setStringValue(String metricKey, int line, String value) { Preconditions.checkNotNull(metricKey); Preconditions.checkArgument(line > 0); @@ -80,6 +83,7 @@ public class DefaultFileLinesContext implements FileLinesContext { setValue(metricKey, line, value); } + @Override public String getStringValue(String metricKey, int line) { Preconditions.checkNotNull(metricKey); Preconditions.checkArgument(line > 0); @@ -106,6 +110,7 @@ public class DefaultFileLinesContext implements FileLinesContext { getOrCreateLines(metricKey).put(line, value); } + @Override public void save() { for (Map.Entry<String, Map<Integer, Object>> entry : map.entrySet()) { String metricKey = entry.getKey(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectTree.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectTree.java index 60d7eced356..1d9aeed130f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectTree.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultProjectTree.java @@ -77,6 +77,7 @@ public class DefaultProjectTree implements ProjectTree { return projects; } + @Override public Project getRootProject() { for (Project project : projects) { if (project.getParent() == null) { @@ -86,6 +87,7 @@ public class DefaultProjectTree implements ProjectTree { throw new IllegalStateException("Can not find the root project from the list of Maven modules"); } + @Override public ProjectDefinition getProjectDefinition(Project project) { for (Map.Entry<ProjectDefinition, Project> entry : projectsByDef.entrySet()) { if (ObjectUtils.equals(entry.getValue(), project)) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java index 089b2a3c58f..b8092ee54b4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java @@ -63,6 +63,7 @@ public class DefaultSensorContext implements SensorContext { return project; } + @Override public boolean index(Resource resource) { // SONAR-5006 if (indexedByCore(resource)) { @@ -176,6 +177,7 @@ public class DefaultSensorContext implements SensorContext { } } + @Override public void saveViolation(Violation violation, boolean force) { if (violation.getResource() == null) { violation.setResource(resourceOrProject(violation.getResource())); @@ -183,10 +185,12 @@ public class DefaultSensorContext implements SensorContext { index.addViolation(violation, force); } + @Override public void saveViolation(Violation violation) { saveViolation(violation, false); } + @Override public void saveViolations(Collection<Violation> violations) { if (violations != null) { for (Violation violation : violations) { @@ -195,42 +199,52 @@ public class DefaultSensorContext implements SensorContext { } } + @Override public Dependency saveDependency(Dependency dependency) { return index.addDependency(dependency); } + @Override public Set<Dependency> getDependencies() { return index.getDependencies(); } + @Override public Collection<Dependency> getIncomingDependencies(Resource to) { return index.getIncomingEdges(resourceOrProject(to)); } + @Override public Collection<Dependency> getOutgoingDependencies(Resource from) { return index.getOutgoingEdges(resourceOrProject(from)); } + @Override public void saveSource(Resource reference, String source) { // useless since 4.2. } + @Override public void saveLink(ProjectLink link) { index.addLink(link); } + @Override public void deleteLink(String key) { index.deleteLink(key); } + @Override public List<Event> getEvents(Resource resource) { return index.getEvents(resource); } + @Override public Event createEvent(Resource resource, String name, String description, String category, Date date) { return index.addEvent(resource, name, description, category, date); } + @Override public void deleteEvent(Event event) { index.deleteEvent(event); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java index 565417efad0..648b624bfa4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultTimeMachine.java @@ -59,6 +59,7 @@ public class DefaultTimeMachine implements TimeMachine { this.techDebtModel = techDebtModel; } + @Override public List<Measure> getMeasures(TimeMachineQuery query) { Map<Integer, Metric> metricById = getMetricsById(query); @@ -76,6 +77,7 @@ public class DefaultTimeMachine implements TimeMachine { return result; } + @Override public List<Object[]> getMeasuresFields(TimeMachineQuery query) { Map<Integer, Metric> metricById = getMetricsById(query); List<Object[]> rows = execute(query, false, metricById.keySet()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/FormulaDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/FormulaDecorator.java index b0dd6bf3d11..75de88257d8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/FormulaDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/FormulaDecorator.java @@ -64,6 +64,7 @@ public final class FormulaDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -92,6 +93,7 @@ public final class FormulaDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public void decorate(Resource resource, DecoratorContext context) { if (context.getMeasure(metric) != null) { return; diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchDatabaseSessionFactory.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchDatabaseSessionFactory.java index 40ae273a23c..1178041b439 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchDatabaseSessionFactory.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchDatabaseSessionFactory.java @@ -30,10 +30,12 @@ public class BatchDatabaseSessionFactory implements DatabaseSessionFactory { this.session = session; } + @Override public DatabaseSession getSession() { return session; } + @Override public void clear() { } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java index e65adbce4fc..0ecd4d2b0ae 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java @@ -106,14 +106,17 @@ public class BatchPluginRepository implements PluginRepository { } } + @Override public Plugin getPlugin(String key) { return pluginsByKey.get(key); } + @Override public Collection<PluginMetadata> getMetadata() { return metadataByKey.values(); } + @Override public PluginMetadata getMetadata(String pluginKey) { return metadataByKey.get(pluginKey); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java index 1332f59b062..7d611676d2c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DefaultPluginsReferential.java @@ -56,6 +56,7 @@ public class DefaultPluginsReferential implements PluginsReferential { try { final RemotePluginFile file = remote.file(); return fileCache.get(file.getFilename(), file.getHash(), new FileCache.Downloader() { + @Override public void download(String filename, File toFile) throws IOException { String url = "/deploy/plugins/" + remote.getKey() + "/" + file.getFilename(); if (LOG.isDebugEnabled()) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java index 87eca7394bc..849c5269da7 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java @@ -63,6 +63,7 @@ public class JdbcDriverHolder { String hash = nameAndHash[1]; File jdbcDriver = fileCache.get(filename, hash, new FileCache.Downloader() { + @Override public void download(String filename, File toFile) throws IOException { String url = "/deploy/" + filename; if (LOG.isDebugEnabled()) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java index 17af5c5fcf0..0ba55b20c9d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java @@ -84,6 +84,7 @@ public class TaskContainer extends ComponentContainer { private void installTaskExtensions() { getComponentByType(ExtensionInstaller.class).install(this, new ExtensionMatcher() { + @Override public boolean accept(Object extension) { return ExtensionUtils.isType(extension, TaskComponent.class); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java index c2c9c6b0e4c..f4521d664a6 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java @@ -79,6 +79,7 @@ public final class DebtDecorator implements Decorator { this.ruleFinder = ruleFinder; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -88,6 +89,7 @@ public final class DebtDecorator implements Decorator { return Arrays.<Metric>asList(CoreMetrics.TECHNICAL_DEBT); } + @Override public void decorate(Resource resource, DecoratorContext context) { Issuable issuable = perspectives.as(Issuable.class, resource); if (issuable != null && shouldSaveMeasure(context)) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java index d34d0004500..7b925117ca1 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java @@ -86,6 +86,7 @@ public class IssueChangelogDebtCalculator implements BatchComponent { // Changelog have to be sorted from newest to oldest. // Null date should be the first as this happen when technical debt has changed since previous analysis. Ordering<FieldDiffs> ordering = Ordering.natural().reverse().nullsFirst().onResultOf(new Function<FieldDiffs, Date>() { + @Override public Date apply(FieldDiffs diff) { return diff.creationDate(); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java index 7320c9c912d..43046d3763b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java @@ -63,6 +63,7 @@ public final class NewDebtDecorator implements Decorator { this.issueChangelogDebtCalculator = issueChangelogDebtCalculator; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -74,6 +75,7 @@ public final class NewDebtDecorator implements Decorator { ); } + @Override public void decorate(Resource resource, DecoratorContext context) { Issuable issuable = perspectives.as(Issuable.class, resource); if (issuable != null && shouldSaveNewMetrics(context)) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java index 35672b85d2b..3b1a1f49fbb 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingDecorator.java @@ -63,6 +63,7 @@ public final class SqaleRatingDecorator implements Decorator { this.fs = null; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -79,6 +80,7 @@ public final class SqaleRatingDecorator implements Decorator { return Lists.<Metric>newArrayList(CoreMetrics.SQALE_RATING, CoreMetrics.DEVELOPMENT_COST, CoreMetrics.SQALE_DEBT_RATIO); } + @Override public void decorate(Resource resource, DecoratorContext context) { if (ResourceUtils.isPersistable(resource) && !ResourceUtils.isUnitTestClass(resource)) { Long developmentCost = getDevelopmentCost(context); diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/BaseTangleIndexDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/BaseTangleIndexDecorator.java index c550c312bad..509cedcc7f1 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/BaseTangleIndexDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/BaseTangleIndexDecorator.java @@ -57,6 +57,7 @@ public class BaseTangleIndexDecorator implements Decorator { return tangleIndexMetric; } + @Override public final boolean shouldExecuteOnProject(Project project) { return true; } @@ -64,6 +65,7 @@ public class BaseTangleIndexDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public final void decorate(Resource resource, DecoratorContext context) { if (!shouldDecorateResource(context)) { return; diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java index 0aaa2aa854d..0446d61fd38 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java @@ -50,10 +50,12 @@ public class DirectoryDsmDecorator implements Decorator { this.index = index; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(final Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource, context)) { List<DecoratorContext> fileContexts = context.getChildren(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java b/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java index 67f92b40e55..9b618b7b4e8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java @@ -94,6 +94,7 @@ public class MavenDependenciesSensor implements Sensor { this.index = index; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -157,6 +158,7 @@ public class MavenDependenciesSensor implements Sensor { } + @Override public void analyse(final Project project, final SensorContext context) { if (settings.hasKey(SONAR_MAVEN_PROJECT_DEPENDENCY)) { LOG.debug("Using dependency provided by property " + SONAR_MAVEN_PROJECT_DEPENDENCY); @@ -185,10 +187,12 @@ public class MavenDependenciesSensor implements Sensor { DependencyNode root = treeBuilder.buildDependencyTree(project.getPom(), localRepository, artifactFactory, artifactMetadataSource, null, artifactCollector); DependencyNodeVisitor visitor = new BuildingDependencyNodeVisitor(new DependencyNodeVisitor() { + @Override public boolean visit(DependencyNode node) { return true; } + @Override public boolean endVisit(DependencyNode node) { if (node.getParent() != null && node.getParent() != node) { saveDependency(project, node, context); diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java index c030e586a50..f9ae4de6a50 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java @@ -48,10 +48,12 @@ public class ProjectDsmDecorator implements Decorator { this.index = index; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(final Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource, context)) { Collection<Resource> subProjects = getSubProjects((Project) resource); diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java index d58012869c7..3d850f3ab50 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java @@ -50,10 +50,12 @@ public class SubProjectDsmDecorator implements Decorator { this.index = index; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } + @Override public void decorate(final Resource resource, DecoratorContext context) { if (shouldDecorateResource(resource, context)) { List<DecoratorContext> directoryContexts = context.getChildren(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 57814cad4ec..1c37360eb8b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -297,6 +297,7 @@ public class DefaultIndex extends SonarIndex { return dependencies; } + @Override public Dependency getEdge(Resource from, Resource to) { Map<Resource, Dependency> map = outgoingDependenciesByResource.get(from); if (map != null) { @@ -305,14 +306,17 @@ public class DefaultIndex extends SonarIndex { return null; } + @Override public boolean hasEdge(Resource from, Resource to) { return getEdge(from, to) != null; } + @Override public Set<Resource> getVertices() { return buckets.keySet(); } + @Override public Collection<Dependency> getOutgoingEdges(Resource from) { Map<Resource, Dependency> deps = outgoingDependenciesByResource.get(from); if (deps != null) { @@ -321,6 +325,7 @@ public class DefaultIndex extends SonarIndex { return Collections.emptyList(); } + @Override public Collection<Dependency> getIncomingEdges(Resource to) { Map<Resource, Dependency> deps = incomingDependenciesByResource.get(to); if (deps != null) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java index 6b42c7184bf..b70c623b9d6 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultPersistenceManager.java @@ -48,15 +48,18 @@ public final class DefaultPersistenceManager implements PersistenceManager { this.eventPersister = eventPersister; } + @Override public void clear() { resourcePersister.clear(); sourcePersister.clear(); } + @Override public void saveProject(Project project, @Nullable Project parent) { resourcePersister.saveProject(project, parent); } + @Override public Snapshot saveResource(Project project, Resource resource, @Nullable Resource parent) { if (ResourceUtils.isPersistable(resource)) { return resourcePersister.saveResource(project, resource, parent); @@ -64,36 +67,44 @@ public final class DefaultPersistenceManager implements PersistenceManager { return null; } + @Override public void setSource(Resource file, String source) { sourcePersister.saveSource(file, source); } + @Override public String getSource(Resource resource) { return sourcePersister.getSource(resource); } + @Override public void saveDependency(Project project, Dependency dependency, Dependency parentDependency) { if (ResourceUtils.isPersistable(dependency.getFrom()) && ResourceUtils.isPersistable(dependency.getTo())) { dependencyPersister.saveDependency(project, dependency, parentDependency); } } + @Override public void saveLink(Project project, ProjectLink link) { linkPersister.saveLink(project, link); } + @Override public void deleteLink(Project project, String key) { linkPersister.deleteLink(project, key); } + @Override public List<Event> getEvents(Resource resource) { return eventPersister.getEvents(resource); } + @Override public void deleteEvent(Event event) { eventPersister.deleteEvent(event); } + @Override public void saveEvent(Resource resource, Event event) { if (ResourceUtils.isPersistable(resource)) { eventPersister.saveEvent(resource, event); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java index 7eeb87ea4f9..fcc4dd0262c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java @@ -69,6 +69,7 @@ public final class DefaultResourcePersister implements ResourcePersister { this.resourceCache = resourceCache; } + @Override public Snapshot saveProject(Project project, @Nullable Project parent) { Snapshot snapshot = snapshotsByResource.get(project); if (snapshot == null) { @@ -129,11 +130,13 @@ public final class DefaultResourcePersister implements ResourcePersister { return snapshot; } + @Override @CheckForNull public Snapshot getSnapshot(@Nullable Resource reference) { return snapshotsByResource.get(reference); } + @Override public Snapshot getSnapshotOrFail(Resource resource) { Snapshot snapshot = getSnapshot(resource); if (snapshot == null) { @@ -158,10 +161,12 @@ public final class DefaultResourcePersister implements ResourcePersister { return snapshotsByResource; } + @Override public Snapshot saveResource(Project project, Resource resource) { return saveResource(project, resource, null); } + @Override public Snapshot saveResource(Project project, Resource resource, @Nullable Resource parent) { Snapshot snapshot = snapshotsByResource.get(resource); if (snapshot == null) { @@ -245,6 +250,7 @@ public final class DefaultResourcePersister implements ResourcePersister { return snapshot; } + @Override @CheckForNull public Snapshot getLastSnapshot(Snapshot snapshot, boolean onlyOlder) { String hql = "SELECT s FROM " + Snapshot.class.getSimpleName() + " s WHERE s.last=:last AND s.resourceId=:resourceId"; @@ -260,6 +266,7 @@ public final class DefaultResourcePersister implements ResourcePersister { return session.getSingleResult(query, null); } + @Override public void clear() { // we keep cache of projects for (Iterator<Map.Entry<Resource, Snapshot>> it = snapshotsByResource.entrySet().iterator(); it.hasNext();) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/ScanIssueStorage.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ScanIssueStorage.java index 18cbd39daba..4ca89943fc1 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/ScanIssueStorage.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ScanIssueStorage.java @@ -53,6 +53,7 @@ public class ScanIssueStorage extends IssueStorage implements BatchComponent { this.projectTree = projectTree; } + @Override protected void doInsert(DbSession session, Date now, DefaultIssue issue) { IssueMapper issueMapper = session.getMapper(IssueMapper.class); long componentId = componentId(issue); @@ -62,6 +63,7 @@ public class ScanIssueStorage extends IssueStorage implements BatchComponent { issueMapper.insert(dto); } + @Override protected void doUpdate(DbSession session, Date now, DefaultIssue issue) { IssueMapper issueMapper = session.getMapper(IssueMapper.class); IssueDto dto = IssueDto.toDtoForUpdate(issue, projectId(), now); diff --git a/sonar-batch/src/main/java/org/sonar/batch/language/LanguageDistributionDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/language/LanguageDistributionDecorator.java index 6b4842f71dc..cc246cfc793 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/language/LanguageDistributionDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/language/LanguageDistributionDecorator.java @@ -35,6 +35,7 @@ import org.sonar.api.resources.ResourceUtils; public class LanguageDistributionDecorator implements Decorator { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -49,6 +50,7 @@ public class LanguageDistributionDecorator implements Decorator { return CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION; } + @Override public void decorate(Resource resource, DecoratorContext context) { CountDistributionBuilder nclocDistribution = new CountDistributionBuilder(CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION); if (ResourceUtils.isFile(resource)) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/languages/DefaultLanguagesReferential.java b/sonar-batch/src/main/java/org/sonar/batch/languages/DefaultLanguagesReferential.java index e9099c197cc..4d43ea2d8ce 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/languages/DefaultLanguagesReferential.java +++ b/sonar-batch/src/main/java/org/sonar/batch/languages/DefaultLanguagesReferential.java @@ -41,6 +41,7 @@ public class DefaultLanguagesReferential implements LanguagesReferential { /** * Get language. */ + @Override @CheckForNull public Language get(String languageKey) { org.sonar.api.resources.Language language = languages.get(languageKey); @@ -50,6 +51,7 @@ public class DefaultLanguagesReferential implements LanguagesReferential { /** * Get list of all supported languages. */ + @Override public Collection<Language> all() { org.sonar.api.resources.Language[] all = languages.all(); Collection<Language> result = new ArrayList<Language>(all.length); diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorExecutionEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorExecutionEvent.java index d571a51855d..b58cc9cc633 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorExecutionEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorExecutionEvent.java @@ -32,6 +32,7 @@ class DecoratorExecutionEvent extends AbstractPhaseEvent<DecoratorExecutionHandl this.decorator = decorator; } + @Override public Decorator getDecorator() { return decorator; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsPhaseEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsPhaseEvent.java index b3e82da38c4..7854fc03316 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsPhaseEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsPhaseEvent.java @@ -34,6 +34,7 @@ class DecoratorsPhaseEvent extends AbstractPhaseEvent<DecoratorsPhaseHandler> this.decorators = decorators; } + @Override public List<Decorator> getDecorators() { return decorators; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java b/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java index 32b26389862..f6cc90b7847 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/GraphPersister.java @@ -48,6 +48,7 @@ public class GraphPersister implements ScanPersister { this.builders = builders; } + @Override public void persist() { DbSession session = myBatis.openSession(true); GraphDtoMapper mapper = session.getMapper(GraphDtoMapper.class); diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/InitializerExecutionEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/InitializerExecutionEvent.java index cc024c4a2e6..5e2b03d64d7 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/InitializerExecutionEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/InitializerExecutionEvent.java @@ -32,6 +32,7 @@ class InitializerExecutionEvent extends AbstractPhaseEvent<InitializerExecutionH this.initializer = initializer; } + @Override public Initializer getInitializer() { return initializer; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersPhaseEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersPhaseEvent.java index ab7ab3916d2..691c279957a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersPhaseEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/InitializersPhaseEvent.java @@ -34,6 +34,7 @@ class InitializersPhaseEvent extends AbstractPhaseEvent<InitializersPhaseHandler this.initializers = initializers; } + @Override public List<Initializer> getInitializers() { return initializers; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersPhaseEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersPhaseEvent.java index c2074effcda..ad43c00ab36 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersPhaseEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersPhaseEvent.java @@ -34,6 +34,7 @@ class PersistersPhaseEvent extends AbstractPhaseEvent<PersistersPhaseHandler> this.persisters = persisters; } + @Override public List<ScanPersister> getPersisters() { return persisters; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java index 9c80c0d7255..05eda79a065 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java @@ -42,12 +42,14 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, DecoratorExec private TimeProfiler profiler = new TimeProfiler(LOG); private DecoratorsProfiler decoratorsProfiler = new DecoratorsProfiler(); + @Override public void onSensorsPhase(SensorsPhaseEvent event) { if (event.isStart()) { LOG.debug("Sensors : {}", StringUtils.join(event.getSensors(), " -> ")); } } + @Override public void onSensorExecution(SensorExecutionEvent event) { if (event.isStart()) { profiler.start("Sensor " + event.getSensor()); @@ -56,6 +58,7 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, DecoratorExec } } + @Override public void onDecoratorExecution(DecoratorExecutionEvent event) { if (event.isStart()) { decoratorsProfiler.start(event.getDecorator()); @@ -64,6 +67,7 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, DecoratorExec } } + @Override public void onDecoratorsPhase(DecoratorsPhaseEvent event) { if (event.isStart()) { LOG.info("Execute decorators..."); diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobPhaseEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobPhaseEvent.java index e886fd9b008..52cf4826cf1 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobPhaseEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobPhaseEvent.java @@ -34,6 +34,7 @@ class PostJobPhaseEvent extends AbstractPhaseEvent<PostJobsPhaseHandler> this.postJobs = postJobs; } + @Override public List<PostJob> getPostJobs() { return postJobs; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectAnalysisEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectAnalysisEvent.java index 3131c6663ea..7c4ac3234e5 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectAnalysisEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectAnalysisEvent.java @@ -32,6 +32,7 @@ class ProjectAnalysisEvent extends AbstractPhaseEvent<ProjectAnalysisHandler> this.project = project; } + @Override public Project getProject() { return project; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorExecutionEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorExecutionEvent.java index bbb3c81005e..9e8593ba7d6 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorExecutionEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorExecutionEvent.java @@ -32,6 +32,7 @@ class SensorExecutionEvent extends AbstractPhaseEvent<SensorExecutionHandler> this.sensor = sensor; } + @Override public Sensor getSensor() { return sensor; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsPhaseEvent.java b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsPhaseEvent.java index f18c6ac9f6d..6ef613088fd 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsPhaseEvent.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsPhaseEvent.java @@ -34,6 +34,7 @@ class SensorsPhaseEvent extends AbstractPhaseEvent<SensorsPhaseHandler> this.sensors = sensors; } + @Override public List<Sensor> getSensors() { return sensors; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java index 42d61fb4f64..fed134857cc 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java @@ -132,6 +132,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx println(""); } + @Override public void onSensorsPhase(SensorsPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.SENSOR); @@ -140,6 +141,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onSensorExecution(SensorExecutionEvent event) { PhaseProfiling profiling = currentModuleProfiling.getProfilingPerPhase(Phases.Phase.SENSOR); if (event.isStart()) { @@ -149,6 +151,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onPersistersPhase(PersistersPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.PERSISTER); @@ -157,6 +160,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onPersisterExecution(PersisterExecutionEvent event) { PhaseProfiling profiling = currentModuleProfiling.getProfilingPerPhase(Phases.Phase.PERSISTER); if (event.isStart()) { @@ -166,6 +170,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onDecoratorExecution(DecoratorExecutionEvent event) { PhaseProfiling profiling = currentModuleProfiling.getProfilingPerPhase(Phases.Phase.DECORATOR); if (event.isStart()) { @@ -178,6 +183,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onDecoratorsPhase(DecoratorsPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.DECORATOR); @@ -190,6 +196,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onPostJobsPhase(PostJobsPhaseEvent event) { if (event.isStart()) { currentModuleProfiling.addPhaseProfiling(Phases.Phase.POSTJOB); @@ -198,6 +205,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx } } + @Override public void onPostJobExecution(PostJobExecutionEvent event) { PhaseProfiling profiling = currentModuleProfiling.getProfilingPerPhase(Phases.Phase.POSTJOB); if (event.isStart()) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java index 26fccb3d739..824610b5d01 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java +++ b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java @@ -44,6 +44,7 @@ public class GenerateQualityGateEvents implements Decorator { this.notificationManager = notificationManager; } + @Override public boolean shouldExecuteOnProject(Project project) { return qualityGate.isEnabled(); } @@ -53,6 +54,7 @@ public class GenerateQualityGateEvents implements Decorator { return CoreMetrics.ALERT_STATUS; } + @Override public void decorate(Resource resource, DecoratorContext context) { if (!shouldDecorateResource(resource)) { return; diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java index 9ebc5db4624..05371f00828 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileDecorator.java @@ -39,6 +39,7 @@ public class QProfileDecorator implements Decorator { return CoreMetrics.QUALITY_PROFILES; } + @Override public boolean shouldExecuteOnProject(Project project) { return !project.getModules().isEmpty(); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java index 3de4a4b985b..53fb0894817 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java @@ -62,6 +62,7 @@ public class QProfileEventsDecorator implements Decorator { return CoreMetrics.QUALITY_PROFILES; } + @Override public boolean shouldExecuteOnProject(Project project) { return true; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileSensor.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileSensor.java index 8f84c66ca90..13ab4448d78 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileSensor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileSensor.java @@ -39,11 +39,13 @@ public class QProfileSensor implements Sensor { this.fs = fs; } + @Override public boolean shouldExecuteOnProject(Project project) { // Should be only executed on leaf modules return project.getModules().isEmpty(); } + @Override public void analyse(Project project, SensorContext context) { UsedQProfiles used = new UsedQProfiles(); for (String language : fs.languages()) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java index ae6b1aa4ee6..e2b78269175 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java @@ -200,6 +200,7 @@ public class ModuleScanContainer extends ComponentContainer { private void addExtensions() { ExtensionInstaller installer = getComponentByType(ExtensionInstaller.class); installer.install(this, new ExtensionMatcher() { + @Override public boolean accept(Object extension) { if (ExtensionUtils.isType(extension, BatchComponent.class) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_PROJECT)) { // Special use-case: the extension point ProjectBuilder is used in a Maven environment to define some diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java index 6a115108a0b..3c881aada88 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java @@ -234,6 +234,7 @@ public class ProjectScanContainer extends ComponentContainer { } static class BatchExtensionFilter implements ExtensionMatcher { + @Override public boolean accept(Object extension) { return ExtensionUtils.isType(extension, BatchComponent.class) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_BATCH); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java index 0ff2d3be352..2ded6e055b4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java @@ -43,6 +43,7 @@ public class ScanTask implements Task { this.taskContainer = taskContainer; } + @Override public void execute() { boolean sensorMode = CoreProperties.ANALYSIS_MODE_SENSOR.equals(taskContainer.getComponentByType(BootstrapProperties.class).property(CoreProperties.ANALYSIS_MODE)); if (sensorMode) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ProjectFileSystemAdapter.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ProjectFileSystemAdapter.java index ba0fe388bca..0617ea8e8fa 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ProjectFileSystemAdapter.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ProjectFileSystemAdapter.java @@ -68,14 +68,17 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { // used to avoid NPE in Project#getFileSystem() } + @Override public Charset getSourceCharset() { return target.sourceCharset(); } + @Override public File getBasedir() { return target.baseDir(); } + @Override public File getBuildDir() { File dir = target.buildDir(); if (dir == null) { @@ -85,6 +88,7 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { return dir; } + @Override public File getBuildOutputDir() { File dir = Iterables.getFirst(target.binaryDirs(), null); if (dir == null) { @@ -95,24 +99,29 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { return dir; } + @Override public List<File> getSourceDirs() { return target.sourceDirs(); } + @Override public ProjectFileSystem addSourceDir(File dir) { target.addSourceDir(dir); return this; } + @Override public List<File> getTestDirs() { return target.testDirs(); } + @Override public ProjectFileSystem addTestDir(File dir) { target.addTestDir(dir); return this; } + @Override public File getReportOutputDir() { if (pom != null) { return resolvePath(pom.getReporting().getOutputDirectory()); @@ -121,10 +130,12 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { return new File(getBuildDir(), "site"); } + @Override public File getSonarWorkingDirectory() { return target.workingDir(); } + @Override public File resolvePath(String path) { File file = new File(path); if (!file.isAbsolute()) { @@ -137,43 +148,51 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { return file; } + @Override public List<File> getSourceFiles(Language... langs) { return Lists.newArrayList(target.files(target.predicates().and( target.predicates().hasType(org.sonar.api.batch.fs.InputFile.Type.MAIN), newHasLanguagesPredicate(langs)))); } + @Override public List<File> getJavaSourceFiles() { return getSourceFiles(Java.INSTANCE); } + @Override public boolean hasJavaSourceFiles() { return !getJavaSourceFiles().isEmpty(); } + @Override public List<File> getTestFiles(Language... langs) { return Lists.newArrayList(target.files(target.predicates().and( target.predicates().hasType(org.sonar.api.batch.fs.InputFile.Type.TEST), newHasLanguagesPredicate(langs)))); } + @Override public boolean hasTestFiles(Language lang) { return target.hasFiles(target.predicates().and( target.predicates().hasType(org.sonar.api.batch.fs.InputFile.Type.TEST), target.predicates().hasLanguage(lang.getKey()))); } + @Override public File writeToWorkingDirectory(String content, String fileName) throws IOException { File file = new File(target.workingDir(), fileName); FileUtils.writeStringToFile(file, content, CharEncoding.UTF_8); return file; } + @Override public File getFileFromBuildDirectory(String filename) { File file = new File(getBuildDir(), filename); return file.exists() ? file : null; } + @Override public Resource toResource(File file) { if (file == null || !file.exists()) { return null; @@ -185,6 +204,7 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { return file.isFile() ? org.sonar.api.resources.File.create(relativePath) : org.sonar.api.resources.Directory.create(relativePath); } + @Override public List<InputFile> mainFiles(String... langs) { return Lists.newArrayList((Iterable) target.inputFiles(target.predicates().and( target.predicates().hasType(org.sonar.api.batch.fs.InputFile.Type.MAIN), @@ -193,6 +213,7 @@ public class ProjectFileSystemAdapter implements ProjectFileSystem { } + @Override public List<InputFile> testFiles(String... langs) { return Lists.newArrayList((Iterable) target.inputFiles(target.predicates().and( target.predicates().hasType(org.sonar.api.batch.fs.InputFile.Type.TEST), diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java index bd8cee930d8..ca7b9700f5f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureValueCoder.java @@ -42,6 +42,7 @@ class MeasureValueCoder implements ValueCoder { this.techDebtModel = techDebtModel; } + @Override public void put(Value value, Object object, CoderContext context) { Measure<?> m = (Measure) object; value.putUTF(m.getMetricKey()); @@ -76,6 +77,7 @@ class MeasureValueCoder implements ValueCoder { } } + @Override public Object get(Value value, Class clazz, CoderContext context) { Measure<?> m = new Measure(); String metricKey = value.getString(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContext.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContext.java index c4aa0550914..5574c33e04e 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContext.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContext.java @@ -49,6 +49,7 @@ public class DefaultFileLinesContext implements FileLinesContext { this.inputFile = inputFile; } + @Override public void setIntValue(String metricKey, int line, int value) { Preconditions.checkNotNull(metricKey); Preconditions.checkArgument(line > 0); @@ -56,10 +57,12 @@ public class DefaultFileLinesContext implements FileLinesContext { setValue(metricKey, line, value); } + @Override public Integer getIntValue(String metricKey, int line) { throw new UnsupportedOperationException(); } + @Override public void setStringValue(String metricKey, int line, String value) { Preconditions.checkNotNull(metricKey); Preconditions.checkArgument(line > 0); @@ -68,6 +71,7 @@ public class DefaultFileLinesContext implements FileLinesContext { setValue(metricKey, line, value); } + @Override public String getStringValue(String metricKey, int line) { throw new UnsupportedOperationException(); } @@ -85,6 +89,7 @@ public class DefaultFileLinesContext implements FileLinesContext { getOrCreateLines(metricKey).put(line, value); } + @Override public void save() { for (Map.Entry<String, Map<Integer, Object>> entry : map.entrySet()) { String metricKey = entry.getKey(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java index 41a2cda0390..5d3cb485f47 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java @@ -130,6 +130,7 @@ public class ModuleScanContainer extends ComponentContainer { private void addExtensions() { ExtensionInstaller installer = getComponentByType(ExtensionInstaller.class); installer.install(this, new ExtensionMatcher() { + @Override public boolean accept(Object extension) { return ExtensionUtils.isType(extension, BatchComponent.class) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_PROJECT); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java index 8eeb6c5b113..431529be787 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ProjectScanContainer.java @@ -158,6 +158,7 @@ public class ProjectScanContainer extends ComponentContainer { } static class BatchExtensionFilter implements ExtensionMatcher { + @Override public boolean accept(Object extension) { return ExtensionUtils.isType(extension, BatchComponent.class) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_BATCH); diff --git a/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTask.java b/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTask.java index 06e891df925..93a0419b32f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTask.java +++ b/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTask.java @@ -38,6 +38,7 @@ public class ListTask implements Task { this.tasks = tasks; } + @Override public void execute() { logBlankLine(); log("Available tasks:"); diff --git a/sonar-batch/src/main/java/org/sonar/batch/test/DefaultTestCaseValueCoder.java b/sonar-batch/src/main/java/org/sonar/batch/test/DefaultTestCaseValueCoder.java index 88b5de896d9..402cc624361 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/test/DefaultTestCaseValueCoder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/test/DefaultTestCaseValueCoder.java @@ -38,6 +38,7 @@ class DefaultTestCaseValueCoder implements ValueCoder { this.inputPathCache = inputPathCache; } + @Override public void put(Value value, Object object, CoderContext context) { DefaultTestCase t = (DefaultTestCase) object; value.putUTF(((DefaultInputFile) t.testFile()).moduleKey()); @@ -59,6 +60,7 @@ class DefaultTestCaseValueCoder implements ValueCoder { } } + @Override public Object get(Value value, Class clazz, CoderContext context) { String moduleKey = value.getString(); String relativePath = value.getString(); diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java index c7f9f3d3a7e..35b7b7f69ac 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/HtmlCodeBuilder.java @@ -30,6 +30,7 @@ public class HtmlCodeBuilder implements Appendable { private StringBuilder colorizedCode = new StringBuilder(); private Map variables = new HashMap(); + @Override public Appendable append(CharSequence csq) { for (int i = 0; i < csq.length(); i++) { append(csq.charAt(i)); @@ -37,6 +38,7 @@ public class HtmlCodeBuilder implements Appendable { return this; } + @Override public Appendable append(char c) { if (c == '<') { colorizedCode.append("<"); @@ -50,6 +52,7 @@ public class HtmlCodeBuilder implements Appendable { return this; } + @Override public Appendable append(CharSequence csq, int start, int end) { for (int i = start; i < end; i++) { append(csq.charAt(i)); diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java index 7c5b0c851aa..acd00546716 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/InlineDocTokenizer.java @@ -50,6 +50,7 @@ public abstract class InlineDocTokenizer extends Tokenizer { } private static final EndMatcher LINE_END_MATCHER = new EndMatcher() { + @Override public boolean match(int endFlag) { return endFlag == '\r' || endFlag == '\n'; } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaAnnotationTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaAnnotationTokenizer.java index fc7cdf6b6d2..0394bedaa68 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaAnnotationTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaAnnotationTokenizer.java @@ -33,6 +33,7 @@ public class JavaAnnotationTokenizer extends Tokenizer { } private static final EndMatcher END_TOKEN_MATCHER = new EndMatcher() { + @Override public boolean match(int endFlag) { return !Character.isJavaIdentifierPart(endFlag); } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java index 3216b720ef6..afc1993f9a6 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/JavaConstantTokenizer.java @@ -72,6 +72,7 @@ public class JavaConstantTokenizer extends Tokenizer { private EndMatcher endTokenMatcher = new EndMatcher() { + @Override public boolean match(int endFlag) { return !isJavaConstantPart(endFlag); } diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/LiteralTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/LiteralTokenizer.java index 42161a86d3a..6a1007d5e73 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/LiteralTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/LiteralTokenizer.java @@ -61,6 +61,7 @@ public class LiteralTokenizer extends Tokenizer { literalValue = new StringBuilder(); } + @Override public boolean match(int endFlag) { literalValue.append((char) endFlag); return code.lastChar()==firstChar && evenNumberOfBackSlashBeforeDelimiter() && literalValue.length()>1; diff --git a/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java b/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java index 005d52a3263..1b78f3fa123 100644 --- a/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java +++ b/sonar-colorizer/src/main/java/org/sonar/colorizer/MultilinesDocTokenizer.java @@ -78,6 +78,7 @@ public class MultilinesDocTokenizer extends Tokenizer { this.codeBuilder = codeBuilder; } + @Override public boolean match(int endFlag) { commentSize++; if (commentSize >= endToken.length + startToken.length || (commentSize >= endToken.length && isCommentStartedOnPreviousLine(codeBuilder))) { diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java index 756824740a1..4d11b68ec53 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentDto.java @@ -39,11 +39,13 @@ public class ComponentDto extends AuthorizedComponentDto implements Component { // Return by join for the moment private Long projectId; + @Override public ComponentDto setId(Long id) { super.setId(id); return this; } + @Override public ComponentDto setKey(String key) { super.setKey(key); return this; diff --git a/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java b/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java index a4bbdbed638..7767a6372db 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ComponentVertex.java @@ -24,22 +24,27 @@ import org.sonar.core.graph.BeanVertex; public class ComponentVertex extends BeanVertex implements Component { + @Override public String key() { return (String) getProperty("key"); } + @Override public String path() { return (String) getProperty("path"); } + @Override public String name() { return (String) getProperty("name"); } + @Override public String longName() { return (String) getProperty("longName"); } + @Override public String qualifier() { return (String) getProperty("qualifier"); } diff --git a/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java b/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java index a818164409e..73fde1c1077 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ResourceComponent.java @@ -56,6 +56,7 @@ public class ResourceComponent implements Component { this(resource, null); } + @Override public String key() { return key; } @@ -65,14 +66,17 @@ public class ResourceComponent implements Component { return path; } + @Override public String name() { return name; } + @Override public String longName() { return longName; } + @Override public String qualifier() { return qualifier; } diff --git a/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java b/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java index 142f52a4f7c..b7f30d971d2 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java +++ b/sonar-core/src/main/java/org/sonar/core/component/ScanPerspectives.java @@ -43,6 +43,7 @@ public class ScanPerspectives implements ResourcePerspectives, BatchComponent { } } + @Override @CheckForNull public <P extends Perspective> P as(Class<P> perspectiveClass, Component component) { if (component.key() == null) { @@ -52,6 +53,7 @@ public class ScanPerspectives implements ResourcePerspectives, BatchComponent { return builder.loadPerspective(perspectiveClass, component); } + @Override @CheckForNull public <P extends Perspective> P as(Class<P> perspectiveClass, Resource resource) { Resource indexedResource = resource; diff --git a/sonar-core/src/main/java/org/sonar/core/graph/BeanIterable.java b/sonar-core/src/main/java/org/sonar/core/graph/BeanIterable.java index 827b7b2baaf..c7c1d99f473 100644 --- a/sonar-core/src/main/java/org/sonar/core/graph/BeanIterable.java +++ b/sonar-core/src/main/java/org/sonar/core/graph/BeanIterable.java @@ -35,18 +35,22 @@ public class BeanIterable<T extends BeanElement> implements Iterable<T> { this.beanClass = beanClass; } + @Override public Iterator<T> iterator() { return new Iterator<T>() { private final Iterator<? extends Element> iterator = iterable.iterator(); + @Override public void remove() { throw new UnsupportedOperationException(); } + @Override public boolean hasNext() { return this.iterator.hasNext(); } + @Override public T next() { return graph.wrap(this.iterator.next(), beanClass); } diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java index dc6de022b00..02281c51f9e 100644 --- a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java +++ b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java @@ -117,6 +117,7 @@ public class DefaultI18n implements I18n, ServerExtension, BatchExtension, Start propertyToBundles = null; } + @Override @CheckForNull public String message(Locale locale, String key, @Nullable String defaultValue, Object... parameters) { String bundleKey = propertyToBundles.get(key); @@ -135,15 +136,18 @@ public class DefaultI18n implements I18n, ServerExtension, BatchExtension, Start return formatMessage(value, parameters); } + @Override public String age(Locale locale, long durationInMillis) { DurationLabel.Result duration = DurationLabel.label(durationInMillis); return message(locale, duration.key(), null, duration.value()); } + @Override public String age(Locale locale, Date fromDate, Date toDate) { return age(locale, toDate.getTime() - fromDate.getTime()); } + @Override public String ageFromNow(Locale locale, Date date) { return age(locale, system2.now() - date.getTime()); } @@ -151,14 +155,17 @@ public class DefaultI18n implements I18n, ServerExtension, BatchExtension, Start /** * Format date for the given locale. JVM timezone is used. */ + @Override public String formatDateTime(Locale locale, Date date) { return DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT, locale).format(date); } + @Override public String formatDate(Locale locale, Date date) { return DateFormat.getDateInstance(DateFormat.DEFAULT, locale).format(date); } + @Override public String formatDouble(Locale locale, Double value) { NumberFormat format = DecimalFormat.getNumberInstance(locale); format.setMinimumFractionDigits(1); @@ -166,6 +173,7 @@ public class DefaultI18n implements I18n, ServerExtension, BatchExtension, Start return format.format(value); } + @Override public String formatInteger(Locale locale, Integer value) { return NumberFormat.getNumberInstance(locale).format(value); } diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java b/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java index bdb414adeae..e19a624429f 100644 --- a/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java +++ b/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java @@ -81,17 +81,20 @@ public class RuleI18nManager implements RuleI18n, ServerExtension, BatchExtensio } + @Override @CheckForNull public String getName(String repositoryKey, String ruleKey) { return message(repositoryKey, ruleKey, NAME_SUFFIX); } + @Override @CheckForNull public String getName(Rule rule) { String name = message(rule.getRepositoryKey(), rule.getKey(), NAME_SUFFIX); return name != null ? name : rule.getName(); } + @Override public String getDescription(String repositoryKey, String ruleKey) { String relatedProperty = new StringBuilder().append(RULE_PREFIX).append(repositoryKey).append(".").append(ruleKey).append(NAME_SUFFIX).toString(); @@ -114,6 +117,7 @@ public class RuleI18nManager implements RuleI18n, ServerExtension, BatchExtensio return defaultI18n.messageFromFile(Locale.ENGLISH, ruleKey + ".html", relatedProperty); } + @Override @CheckForNull public String getParamDescription(String repositoryKey, String ruleKey, String paramKey) { return message(repositoryKey, ruleKey, ".param." + paramKey); diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java index ed81a29c067..6106fd7a9ff 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultActionPlan.java @@ -54,6 +54,7 @@ public class DefaultActionPlan implements ActionPlan { return actionPlan; } + @Override public String key() { return key; } @@ -63,6 +64,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override public String name() { return name; } @@ -72,6 +74,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override public String projectKey() { return projectKey; } @@ -81,6 +84,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override @CheckForNull public String description() { return description; @@ -91,6 +95,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override public String userLogin() { return userLogin; } @@ -100,6 +105,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override public String status() { return status; } @@ -109,6 +115,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override @CheckForNull public Date deadLine() { return deadLine != null ? new Date(deadLine.getTime()) : null; @@ -119,6 +126,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override public Date createdAt() { return createdAt; } @@ -128,6 +136,7 @@ public class DefaultActionPlan implements ActionPlan { return this; } + @Override public Date updatedAt() { return updatedAt; } diff --git a/sonar-core/src/main/java/org/sonar/core/metric/DefaultMetricFinder.java b/sonar-core/src/main/java/org/sonar/core/metric/DefaultMetricFinder.java index 7973de419f2..087a6be91b8 100644 --- a/sonar-core/src/main/java/org/sonar/core/metric/DefaultMetricFinder.java +++ b/sonar-core/src/main/java/org/sonar/core/metric/DefaultMetricFinder.java @@ -36,14 +36,17 @@ public class DefaultMetricFinder implements MetricFinder { this.sessionFactory = sessionFactory; } + @Override public Metric findById(int id) { return sessionFactory.getSession().getSingleResult(Metric.class, "id", id, ENABLED, true); } + @Override public Metric findByKey(String key) { return sessionFactory.getSession().getSingleResult(Metric.class, "key", key, ENABLED, true); } + @Override public Collection<Metric> findAll(List<String> metricKeys) { List<Metric> result = Lists.newLinkedList(); for (String metricKey : metricKeys) { @@ -55,6 +58,7 @@ public class DefaultMetricFinder implements MetricFinder { return result; } + @Override public Collection<Metric> findAll() { return doFindAll(); } diff --git a/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java b/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java index d30ea72ac7f..368367441df 100644 --- a/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java +++ b/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java @@ -77,11 +77,13 @@ public class DefaultNotificationManager implements NotificationManager { /** * {@inheritDoc} */ + @Override public void scheduleForSending(Notification notification) { NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification); notificationQueueDao.insert(Arrays.asList(dto)); } + @Override public void scheduleForSending(List<Notification> notification) { notificationQueueDao.insert(Lists.transform(notification, new Function<Notification, NotificationQueueDto>() { @Override @@ -136,6 +138,7 @@ public class DefaultNotificationManager implements NotificationManager { /** * {@inheritDoc} */ + @Override public Multimap<String, NotificationChannel> findSubscribedRecipientsForDispatcher(NotificationDispatcher dispatcher, @Nullable Integer resourceId) { String dispatcherKey = dispatcher.getKey(); diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java b/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java index 44d9f80968d..a5eebcd5114 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DefaultDatabase.java @@ -129,10 +129,12 @@ public class DefaultDatabase implements Database { } } + @Override public final Dialect getDialect() { return dialect; } + @Override public Properties getHibernateProperties() { Properties props = new Properties(); @@ -147,6 +149,7 @@ public class DefaultDatabase implements Database { return props; } + @Override public final DataSource getDataSource() { return datasource; } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java index 1ccada2b7a8..3c05901b9aa 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java @@ -49,6 +49,7 @@ public class SemaphoreUpdater implements TaskComponent, ServerComponent { public void scheduleForUpdate(final Semaphores.Semaphore semaphore, int updatePeriodInSeconds) { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); Runnable updater = new Runnable() { + @Override public void run() { try { LOG.debug("Updating semaphore " + semaphore.getName()); diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoresImpl.java b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoresImpl.java index 95b3981dc5f..d5028b34fd9 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoresImpl.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoresImpl.java @@ -34,16 +34,19 @@ public class SemaphoresImpl implements Semaphores { this.updater = updater; } + @Override public Semaphore acquire(String name, int maxAgeInSeconds, int updatePeriodInSeconds) { Semaphore semaphore = dao.acquire(name, maxAgeInSeconds); updater.scheduleForUpdate(semaphore, updatePeriodInSeconds); return semaphore; } + @Override public Semaphore acquire(String name) { return dao.acquire(name); } + @Override public void release(String name) { updater.stopUpdate(name); dao.release(name); diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java index 724c74354da..a490947d80c 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/AbstractDialect.java @@ -43,30 +43,37 @@ abstract class AbstractDialect implements Dialect { this.validationQuery = validationQuery; } + @Override public String getId() { return id; } + @Override public String getActiveRecordDialectCode() { return activeRecordDialectCode; } + @Override public String getDefaultDriverClassName() { return defaultDriverClassName; } + @Override public final String getTrueSqlValue() { return trueSqlValue; } + @Override public final String getFalseSqlValue() { return falseSqlValue; } + @Override public final String getValidationQuery() { return validationQuery; } + @Override public List<String> getConnectionInitStatements() { return Collections.emptyList(); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/DialectUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/DialectUtils.java index 8beadff736e..dbcd4e91b19 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/DialectUtils.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/DialectUtils.java @@ -48,6 +48,7 @@ public final class DialectUtils { @CheckForNull private static Dialect findByJdbcUrl(final String jdbcConnectionUrl) { return findDialect(new Predicate<Dialect>() { + @Override public boolean apply(@Nullable Dialect dialect) { return dialect != null && dialect.matchesJdbcURL(StringUtils.trimToEmpty(jdbcConnectionUrl)); } @@ -57,6 +58,7 @@ public final class DialectUtils { @CheckForNull private static Dialect findById(final String dialectId) { return findDialect(new Predicate<Dialect>() { + @Override public boolean apply(@Nullable Dialect dialect) { return dialect != null && dialect.getId().equals(dialectId); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java index 546b0e777c9..d182cf6f9db 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/H2.java @@ -33,10 +33,12 @@ public class H2 extends AbstractDialect { super(ID, ".h2.", "org.h2.Driver", "true", "false", "SELECT 1"); } + @Override public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() { return H2Dialect.class; } + @Override public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:h2:"); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java index 596bb7cdb66..9fc40daed89 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MsSql.java @@ -33,10 +33,12 @@ public class MsSql extends AbstractDialect { super(ID, "sqlserver", "net.sourceforge.jtds.jdbc.Driver", "1", "0", "SELECT 1"); } + @Override public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() { return MsSqlDialect.class; } + @Override public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:microsoft:sqlserver:") || StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:jtds:sqlserver:"); diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java index 435682d17a3..2c6e0c5a135 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/MySql.java @@ -36,10 +36,12 @@ public class MySql extends AbstractDialect { super(ID, "mysql", "com.mysql.jdbc.Driver", "true", "false", "SELECT 1"); } + @Override public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() { return MySqlWithDecimalDialect.class; } + @Override public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:mysql:"); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java index 7d2c6aa040f..d6673158a05 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/Oracle.java @@ -36,10 +36,12 @@ public class Oracle extends AbstractDialect { super(ID, "oracle", "oracle.jdbc.OracleDriver", "1", "0", "SELECT 1 FROM DUAL"); } + @Override public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() { return Oracle10gWithDecimalDialect.class; } + @Override public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:oracle:"); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java index 7c9dd728e3f..3f33da58317 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/dialect/PostgreSql.java @@ -38,10 +38,12 @@ public class PostgreSql extends AbstractDialect { super(ID, "postgre", "org.postgresql.Driver", "true", "false", "SELECT 1"); } + @Override public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() { return PostgreSQLWithDecimalDialect.class; } + @Override public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:postgresql:"); } diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java index 8a4a103cd5a..35cef375c33 100644 --- a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java +++ b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java @@ -67,6 +67,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return new DefaultPluginMetadata().setKey(key); } + @Override public File getFile() { return file; } @@ -76,6 +77,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public List<File> getDeployedFiles() { return deployedFiles; } @@ -94,6 +96,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getKey() { return key; } @@ -103,6 +106,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getName() { return name; } @@ -112,6 +116,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getMainClass() { return mainClass; } @@ -121,6 +126,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getDescription() { return description; } @@ -130,6 +136,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getOrganization() { return organization; } @@ -139,6 +146,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getOrganizationUrl() { return organizationUrl; } @@ -148,6 +156,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getLicense() { return license; } @@ -157,6 +166,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getVersion() { return version; } @@ -175,6 +185,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getParent() { return parent; } @@ -184,6 +195,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public List<String> getRequiredPlugins() { return ImmutableList.copyOf(requiredPlugins); } @@ -212,6 +224,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return actualVersion.compareTo(minimumVersion) >= 0; } + @Override public String getHomepage() { return homepage; } @@ -221,6 +234,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getIssueTrackerUrl() { return issueTrackerUrl; } @@ -235,6 +249,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public boolean isUseChildFirstClassLoader() { return useChildFirstClassLoader; } @@ -244,10 +259,12 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM return this; } + @Override public String getBasePlugin() { return basePlugin; } + @Override public boolean isCore() { return core; } @@ -292,6 +309,7 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable<PluginM .toString(); } + @Override public int compareTo(PluginMetadata other) { return name.compareTo(other.getName()); } diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java index 10dd7a2693d..67a2970ec25 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java @@ -125,6 +125,7 @@ public class PurgeDao { private void disableOrphanResources(final ResourceDto project, final SqlSession session, final PurgeMapper purgeMapper) { session.select("org.sonar.core.purge.PurgeMapper.selectResourceIdsToDisable", project.getId(), new ResultHandler() { + @Override public void handleResult(ResultContext resultContext) { Long resourceId = (Long) resultContext.getResultObject(); if (resourceId != null) { diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeableSnapshotDto.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeableSnapshotDto.java index e2d9ab3c51a..f86b2e983b5 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeableSnapshotDto.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeableSnapshotDto.java @@ -66,6 +66,7 @@ public class PurgeableSnapshotDto implements Comparable<PurgeableSnapshotDto> { return this; } + @Override public int compareTo(PurgeableSnapshotDto other) { return date.compareTo(other.date); } diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java index b908bb4e6bb..00184d0050b 100644 --- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java +++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDto.java @@ -60,6 +60,7 @@ public class ActiveRuleDto extends Dto<ActiveRuleKey> { return this; } + @Override public ActiveRuleKey getKey() { return ActiveRuleKey.of(profileKey, RuleKey.of(repository, ruleField)); } diff --git a/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java b/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java index 314545e3cff..b7de970bfb1 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java @@ -40,6 +40,7 @@ public class DefaultResourcePermissions implements ResourcePermissions { this.permissionFacade = permissionFacade; } + @Override public boolean hasRoles(Resource resource) { DbSession session = myBatis.openSession(false); try { @@ -53,6 +54,7 @@ public class DefaultResourcePermissions implements ResourcePermissions { return false; } + @Override public void grantUserRole(Resource resource, String login, String role) { if (resource.getId() != null) { DbSession session = myBatis.openSession(false); @@ -69,6 +71,7 @@ public class DefaultResourcePermissions implements ResourcePermissions { } } + @Override public void grantGroupRole(Resource resource, String groupName, String role) { if (resource.getId() != null) { DbSession session = myBatis.openSession(false); @@ -86,6 +89,7 @@ public class DefaultResourcePermissions implements ResourcePermissions { permissionFacade.grantDefaultRoles(session, Long.valueOf(resource.getId()), resource.getQualifier()); } + @Override public void grantDefaultRoles(Resource resource) { DbSession session = myBatis.openSession(false); try { diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java index c040bac2ec2..8e4be2cfce8 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java @@ -71,6 +71,7 @@ public class ResourceIndexerDao { try { final ResourceIndexerMapper mapper = session.getMapper(ResourceIndexerMapper.class); session.select("org.sonar.core.resource.ResourceIndexerMapper.selectRootProjectIds", /* workaround to get booleans */ResourceIndexerQuery.create(), new ResultHandler() { + @Override public void handleResult(ResultContext context) { Integer rootProjectId = (Integer) context.getResultObject(); doIndexProject(rootProjectId, session, mapper); @@ -93,6 +94,7 @@ public class ResourceIndexerDao { .setRootProjectId(rootProjectId); session.select(SELECT_RESOURCES, query, new ResultHandler() { + @Override public void handleResult(ResultContext context) { ResourceDto resource = (ResourceDto) context.getResultObject(); doIndex(resource, mapper); @@ -108,6 +110,7 @@ public class ResourceIndexerDao { .setRootProjectId(rootProjectId); session.select(SELECT_RESOURCES, query, new ResultHandler() { + @Override public void handleResult(ResultContext context) { ResourceDto resource = (ResourceDto) context.getResultObject(); diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java index 8e82b618bdd..25d826376f4 100644 --- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java +++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java @@ -55,6 +55,7 @@ public class DefaultTechnicalDebtModel implements TechnicalDebtModel { })); } + @Override @CheckForNull public DefaultCharacteristic characteristicByKey(final String key) { return Iterables.find(characteristics(), new Predicate<DefaultCharacteristic>() { @@ -65,6 +66,7 @@ public class DefaultTechnicalDebtModel implements TechnicalDebtModel { }, null); } + @Override @CheckForNull public DefaultCharacteristic characteristicById(final Integer id) { return Iterables.find(characteristics(), new Predicate<DefaultCharacteristic>() { @@ -75,16 +77,19 @@ public class DefaultTechnicalDebtModel implements TechnicalDebtModel { }, null); } + @Override @CheckForNull public DefaultRequirement requirementsByRule(final RuleKey ruleKey) { return null; } + @Override @CheckForNull public DefaultRequirement requirementsById(final Integer id) { return null; } + @Override public List<DefaultCharacteristic> characteristics() { List<DefaultCharacteristic> flatCharacteristics = newArrayList(); for (DebtCharacteristic characteristic : model.characteristics()) { @@ -97,6 +102,7 @@ public class DefaultTechnicalDebtModel implements TechnicalDebtModel { return flatCharacteristics; } + @Override public List<DefaultRequirement> requirements() { return Collections.emptyList(); } diff --git a/sonar-core/src/main/java/org/sonar/core/test/DefaultCoverageBlock.java b/sonar-core/src/main/java/org/sonar/core/test/DefaultCoverageBlock.java index 0f8b88a7c6f..d2d10cca958 100644 --- a/sonar-core/src/main/java/org/sonar/core/test/DefaultCoverageBlock.java +++ b/sonar-core/src/main/java/org/sonar/core/test/DefaultCoverageBlock.java @@ -29,14 +29,17 @@ import java.util.List; public class DefaultCoverageBlock extends BeanEdge implements CoverageBlock { + @Override public TestCase testCase() { return getVertex(DefaultTestCase.class, Direction.OUT); } + @Override public Testable testable() { return getVertex(DefaultTestable.class, Direction.IN); } + @Override public List<Integer> lines() { return (List<Integer>) getProperty("lines"); } diff --git a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java index 1e78e171f71..3f8c8e86646 100644 --- a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java +++ b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java @@ -49,19 +49,23 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase { private static final String LINES = "lines"; private static final String TESTCASE = "testcase"; + @Override public String type() { return (String) getProperty(TYPE); } + @Override public MutableTestCase setType(@Nullable String s) { setProperty(TYPE, s); return this; } + @Override public Long durationInMs() { return (Long) getProperty(DURATION); } + @Override public MutableTestCase setDurationInMs(@Nullable Long l) { if (l != null && l < 0) { throw new IllegalDurationException("Test duration must be positive (got: " + l + ")"); @@ -70,15 +74,18 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase { return this; } + @Override public Status status() { return Status.of((String) getProperty(STATUS)); } + @Override public MutableTestCase setStatus(@Nullable Status s) { setProperty(STATUS, s == null ? null : s.name()); return this; } + @Override public String name() { return (String) getProperty(NAME); } @@ -88,24 +95,29 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase { return this; } + @Override public String message() { return (String) getProperty(MESSAGE); } + @Override public MutableTestCase setMessage(String s) { setProperty(MESSAGE, s); return this; } + @Override public String stackTrace() { return (String) getProperty(STACK_TRACE); } + @Override public MutableTestCase setStackTrace(String s) { setProperty(STACK_TRACE, s); return this; } + @Override public MutableTestCase setCoverageBlock(Testable testable, List<Integer> lines) { if (coverageBlock(testable) != null) { throw new CoverageAlreadyExistsException("The link between " + name() + " and " + testable.component().key() + " already exists"); @@ -114,15 +126,18 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase { return this; } + @Override public TestPlan testPlan() { Vertex plan = GraphUtil.singleAdjacent(element(), Direction.IN, TESTCASE); return beanGraph().wrap(plan, DefaultTestPlan.class); } + @Override public boolean doesCover() { return edgeCovers().iterator().hasNext(); } + @Override public int countCoveredLines() { int result = 0; for (Edge edge : edgeCovers()) { @@ -132,12 +147,15 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase { return result; } + @Override public Iterable<CoverageBlock> coverageBlocks() { return (Iterable) getEdges(DefaultCoverageBlock.class, Direction.OUT, COVERS); } + @Override public CoverageBlock coverageBlock(final Testable testable) { return Iterables.find(getEdges(DefaultCoverageBlock.class, Direction.OUT, COVERS), new Predicate<CoverageBlock>() { + @Override public boolean apply(CoverageBlock input) { return input.testable().component().key().equals(testable.component().key()); } diff --git a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestPlan.java b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestPlan.java index de6bd37cc92..b701dc29d8e 100644 --- a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestPlan.java +++ b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestPlan.java @@ -36,11 +36,13 @@ import java.util.List; public class DefaultTestPlan extends BeanVertex implements MutableTestPlan { private static final String TESTCASE = "testcase"; + @Override public Component component() { Vertex component = GraphUtil.singleAdjacent(element(), Direction.IN, "testplan"); return beanGraph().wrap(component, ComponentVertex.class); } + @Override @CheckForNull public Iterable<MutableTestCase> testCasesByName(String name) { List<MutableTestCase> result = Lists.newArrayList(); @@ -52,12 +54,14 @@ public class DefaultTestPlan extends BeanVertex implements MutableTestPlan { return result; } + @Override public MutableTestCase addTestCase(String name) { DefaultTestCase testCase = beanGraph().createAdjacentVertex(this, DefaultTestCase.class, TESTCASE); testCase.setName(name); return testCase; } + @Override public Iterable<MutableTestCase> testCases() { return (Iterable) getVertices(DefaultTestCase.class, Direction.OUT, TESTCASE); } diff --git a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestable.java b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestable.java index 82298fa43d8..33e118a6923 100644 --- a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestable.java +++ b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestable.java @@ -44,11 +44,13 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { private static final String COVERS = "covers"; + @Override public Component component() { Vertex component = GraphUtil.singleAdjacent(element(), Direction.IN, "testable"); return beanGraph().wrap(component, ComponentVertex.class); } + @Override public List<TestCase> testCases() { ImmutableList.Builder<TestCase> cases = ImmutableList.builder(); for (Edge coversEdge : coverEdges()) { @@ -58,14 +60,17 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { return cases.build(); } + @Override public TestCase testCaseByName(final String name) { return Iterables.find(testCases(), new Predicate<TestCase>() { + @Override public boolean apply(TestCase input) { return input.name().equals(name); } }, null); } + @Override public int countTestCasesOfLine(Integer line) { int number = 0; for (Edge edge : coverEdges()) { @@ -76,6 +81,7 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { return number; } + @Override public Map<Integer, Integer> testCasesByLines() { Map<Integer, Integer> testCasesByLines = newHashMap(); for (Integer line : testedLines()) { @@ -84,6 +90,7 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { return testCasesByLines; } + @Override public List<TestCase> testCasesOfLine(int line) { ImmutableList.Builder<TestCase> cases = ImmutableList.builder(); for (Edge edge : coverEdges()) { @@ -96,6 +103,7 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { return cases.build(); } + @Override public SortedSet<Integer> testedLines() { ImmutableSortedSet.Builder<Integer> coveredLines = ImmutableSortedSet.naturalOrder(); for (Edge edge : coverEdges()) { @@ -104,14 +112,17 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { return coveredLines.build(); } + @Override public CoverageBlock coverageBlock(final TestCase testCase) { return Iterables.find(getEdges(DefaultCoverageBlock.class, Direction.IN, COVERS), new Predicate<CoverageBlock>() { + @Override public boolean apply(CoverageBlock input) { return input.testCase().name().equals(testCase.name()); } }, null); } + @Override public Iterable<CoverageBlock> coverageBlocks() { return (Iterable) getEdges(DefaultCoverageBlock.class, Direction.IN, COVERS); } diff --git a/sonar-core/src/main/java/org/sonar/core/user/DefaultUser.java b/sonar-core/src/main/java/org/sonar/core/user/DefaultUser.java index e40fbdb5568..09417ea9324 100644 --- a/sonar-core/src/main/java/org/sonar/core/user/DefaultUser.java +++ b/sonar-core/src/main/java/org/sonar/core/user/DefaultUser.java @@ -34,19 +34,23 @@ public class DefaultUser implements User { private String login, name, email; private boolean active; + @Override public String login() { return login; } + @Override public String name() { return name; } + @Override @CheckForNull public String email() { return email; } + @Override public boolean active() { return active; } diff --git a/sonar-core/src/main/java/org/sonar/core/user/HibernateUserFinder.java b/sonar-core/src/main/java/org/sonar/core/user/HibernateUserFinder.java index 094ffaaf9ec..4cc42aacccc 100644 --- a/sonar-core/src/main/java/org/sonar/core/user/HibernateUserFinder.java +++ b/sonar-core/src/main/java/org/sonar/core/user/HibernateUserFinder.java @@ -35,11 +35,13 @@ public class HibernateUserFinder implements UserFinder { this.sessionFactory = sessionFactory; } + @Override public User findById(int id) { DatabaseSession session = sessionFactory.getSession(); return session.getSingleResult(User.class, "id", id); } + @Override public User findByLogin(String login) { DatabaseSession session = sessionFactory.getSession(); return session.getSingleResult(User.class, "login", login); diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/MeasuresDao.java b/sonar-core/src/main/java/org/sonar/jpa/dao/MeasuresDao.java index acb49f23875..1cc6d0b9cfb 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/dao/MeasuresDao.java +++ b/sonar-core/src/main/java/org/sonar/jpa/dao/MeasuresDao.java @@ -62,6 +62,7 @@ public class MeasuresDao { public Collection<Metric> getEnabledMetrics() { return CollectionUtils.select(getMetricsByName().values(), new Predicate() { + @Override public boolean evaluate(Object o) { return ((Metric) o).getEnabled(); } @@ -70,6 +71,7 @@ public class MeasuresDao { public Collection<Metric> getUserDefinedMetrics() { return CollectionUtils.select(getMetricsByName().values(), new Predicate() { + @Override public boolean evaluate(Object o) { Metric m = (Metric) o; return m.getEnabled() && m.getOrigin() != Metric.Origin.JAV; diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/AbstractDatabaseConnector.java b/sonar-core/src/main/java/org/sonar/jpa/session/AbstractDatabaseConnector.java index 85be309fa01..d991e2c4485 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/AbstractDatabaseConnector.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/AbstractDatabaseConnector.java @@ -55,6 +55,7 @@ public abstract class AbstractDatabaseConnector implements DatabaseConnector { database = null; } + @Override public EntityManagerFactory getEntityManagerFactory() { return factory; } @@ -74,14 +75,17 @@ public abstract class AbstractDatabaseConnector implements DatabaseConnector { } } + @Override public EntityManager createEntityManager() { return factory.createEntityManager(); } + @Override public final int getDatabaseVersion() { throw new UnsupportedOperationException("Moved to " + DatabaseVersion.class.getCanonicalName()); } + @Override public final Dialect getDialect() { return database.getDialect(); } diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java b/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java index 78a8039355e..643ba19c45f 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/DefaultDatabaseConnector.java @@ -45,6 +45,7 @@ public class DefaultDatabaseConnector extends AbstractDatabaseConnector { } } + @Override public Connection getConnection() throws SQLException { return database != null && database.getDataSource() != null ? database.getDataSource().getConnection() : null; } diff --git a/sonar-core/src/main/java/org/sonar/jpa/session/ThreadLocalDatabaseSessionFactory.java b/sonar-core/src/main/java/org/sonar/jpa/session/ThreadLocalDatabaseSessionFactory.java index 34610a2d271..9d4a05efcb0 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/session/ThreadLocalDatabaseSessionFactory.java +++ b/sonar-core/src/main/java/org/sonar/jpa/session/ThreadLocalDatabaseSessionFactory.java @@ -30,6 +30,7 @@ public class ThreadLocalDatabaseSessionFactory implements DatabaseSessionFactory this.connector = connector; } + @Override public DatabaseSession getSession() { JpaDatabaseSession session = threadSession.get(); if (session == null) { @@ -40,6 +41,7 @@ public class ThreadLocalDatabaseSessionFactory implements DatabaseSessionFactory return session; } + @Override public void clear() { JpaDatabaseSession session = threadSession.get(); if (session != null) { diff --git a/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractSourceImporter.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractSourceImporter.java index 084c505139f..f453c1e6579 100644 --- a/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractSourceImporter.java +++ b/sonar-deprecated/src/main/java/org/sonar/api/batch/AbstractSourceImporter.java @@ -43,10 +43,12 @@ public abstract class AbstractSourceImporter implements Sensor { this.language = language; } + @Override public boolean shouldExecuteOnProject(Project project) { return false; } + @Override public void analyse(Project project, SensorContext context) { // Do not remove for backward compatibility } diff --git a/sonar-deprecated/src/main/java/org/sonar/api/charts/AbstractChart.java b/sonar-deprecated/src/main/java/org/sonar/api/charts/AbstractChart.java index 016ab133322..acbeb318b96 100644 --- a/sonar-deprecated/src/main/java/org/sonar/api/charts/AbstractChart.java +++ b/sonar-deprecated/src/main/java/org/sonar/api/charts/AbstractChart.java @@ -56,6 +56,7 @@ public abstract class AbstractChart implements Chart { * @param params the chart parameters * @return the generated chart */ + @Override public BufferedImage generateImage(ChartParameters params) { JFreeChart chart = new JFreeChart(null, TextTitle.DEFAULT_FONT, getPlot(params), hasLegend()); improveChart(chart, params); diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java index 05c4bd9bfaf..ad2e60488ff 100644 --- a/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java +++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java @@ -53,6 +53,7 @@ public class NoSonarFilter implements ViolationFilter { } } + @Override public boolean isIgnored(Violation violation) { boolean ignored = false; if (violation.getResource() != null && violation.getLineId() != null) { diff --git a/sonar-deprecated/src/main/java/org/sonar/api/resources/Java.java b/sonar-deprecated/src/main/java/org/sonar/api/resources/Java.java index f5c5b1a97b2..67b27bb4da8 100644 --- a/sonar-deprecated/src/main/java/org/sonar/api/resources/Java.java +++ b/sonar-deprecated/src/main/java/org/sonar/api/resources/Java.java @@ -67,6 +67,7 @@ public class Java extends AbstractLanguage { * * @see AbstractLanguage#getFileSuffixes() */ + @Override public String[] getFileSuffixes() { return SUFFIXES; } diff --git a/sonar-deprecated/src/main/java/org/sonar/api/web/AbstractDashboardWidget.java b/sonar-deprecated/src/main/java/org/sonar/api/web/AbstractDashboardWidget.java index 3937abbabfa..addab4dca69 100644 --- a/sonar-deprecated/src/main/java/org/sonar/api/web/AbstractDashboardWidget.java +++ b/sonar-deprecated/src/main/java/org/sonar/api/web/AbstractDashboardWidget.java @@ -26,10 +26,12 @@ package org.sonar.api.web; @Deprecated public abstract class AbstractDashboardWidget extends AbstractRubyTemplate implements RubyRailsWidget { + @Override public String getId() { return getClass().getSimpleName(); } + @Override public String getTitle() { return getClass().getSimpleName(); } diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java index 69d1da87ce9..5a45dcf2623 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java @@ -132,6 +132,7 @@ public class TokenEntry implements Comparable<TokenEntry> { return other.hashCode == hashCode; } + @Override public int compareTo(TokenEntry other) { return getIndex() - other.getIndex(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java b/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java index 92afd9358a9..e45e6b48840 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java @@ -42,6 +42,7 @@ public final class DuplicationPredicates { this.min = min; } + @Override public boolean apply(@Nullable CloneGroup input) { return input != null && input.getLengthInUnits() >= min; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java b/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java index 5525fd94966..349ada7dd16 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java @@ -129,10 +129,12 @@ public final class Block implements CodeFragment { return indexInFile; } + @Override public int getStartLine() { return startLine; } + @Override public int getEndLine() { return endLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java index fd69c4ed1c2..9d93f9f0958 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java @@ -35,6 +35,7 @@ public final class ContainsInComparator implements Comparator<ClonePart> { * Defines order by resourceId. */ public static final Comparator<ClonePart> RESOURCE_ID_COMPARATOR = new Comparator<ClonePart>() { + @Override public int compare(ClonePart o1, ClonePart o2) { return FastStringComparator.INSTANCE.compare(o1.getResourceId(), o2.getResourceId()); } @@ -44,6 +45,7 @@ public final class ContainsInComparator implements Comparator<ClonePart> { * Defines order by resourceId and by unitStart. */ public static final Comparator<ClonePart> CLONEPART_COMPARATOR = new Comparator<ClonePart>() { + @Override public int compare(ClonePart o1, ClonePart o2) { int c = RESOURCE_ID_COMPARATOR.compare(o1, o2); if (c == 0) { @@ -71,6 +73,7 @@ public final class ContainsInComparator implements Comparator<ClonePart> { * 1 if resourceId of part1 is greater than resourceId of part2 or if unitStart of part1 is greater than unitStart of part2, * -1 in all other cases */ + @Override public int compare(ClonePart part1, ClonePart part2) { int c = RESOURCE_ID_COMPARATOR.compare(part1, part2); if (c == 0) { diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java index 4e896b5e689..6cdd4c0cbcf 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java @@ -205,6 +205,7 @@ final class BlocksGroup { public static final BlockComparator INSTANCE = new BlockComparator(); + @Override public int compare(Block b1, Block b2) { int c = RESOURCE_ID_COMPARATOR.compare(b1.getResourceId(), b2.getResourceId()); if (c == 0) { diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java index 9dbfe1e179e..0a13ccf1b29 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java @@ -34,14 +34,17 @@ public abstract class AbstractText implements Text { this.symbols = symbols; } + @Override public int length() { return symbols.size(); } + @Override public Object symbolAt(int index) { return symbols.get(index); } + @Override public List<Object> sequence(int fromIndex, int toIndex) { return symbols.subList(fromIndex, toIndex); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java index 7d8a3a9877b..f010b4dbf01 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java @@ -54,6 +54,7 @@ public final class Search { } private static final Comparator<Node> DEPTH_COMPARATOR = new Comparator<Node>() { + @Override public int compare(Node o1, Node o2) { return o2.depth - o1.depth; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java index b9a28041bd6..e95bb043b1a 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java @@ -108,6 +108,7 @@ public final class SuffixTreeCloneDetectionAlgorithm { } private static final Comparator<Block> BLOCK_COMPARATOR = new Comparator<Block>() { + @Override public int compare(Block o1, Block o2) { return o1.getIndexInFile() - o2.getIndexInFile(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java index 3b68f4b8381..6a569e27eae 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java @@ -48,10 +48,12 @@ public class ClonePart implements CodeFragment { return startUnit; } + @Override public int getStartLine() { return startLine; } + @Override public int getEndLine() { return endLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java index 1cfc724c1b0..393a8e7d1dd 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java @@ -31,14 +31,17 @@ public class MemoryCloneIndex implements CloneIndex { private Multimap<String, Block> byResource = ArrayListMultimap.create(); private Multimap<ByteArray, Block> byHash = ArrayListMultimap.create(); + @Override public Collection<Block> getByResourceId(String resourceId) { return byResource.get(resourceId); } + @Override public Collection<Block> getBySequenceHash(ByteArray sequenceHash) { return byHash.get(sequenceHash); } + @Override public void insert(Block block) { byResource.put(block.getResourceId(), block); byHash.put(block.getBlockHash(), block); diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java index ed080415de8..21a0f890ab0 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java @@ -92,6 +92,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { * <strong>Note that this implementation does not guarantee that blocks would be sorted by index.</strong> * </p> */ + @Override public Collection<Block> getByResourceId(String resourceId) { ensureSorted(); @@ -134,6 +135,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { /** * {@inheritDoc} */ + @Override public Collection<Block> getBySequenceHash(ByteArray sequenceHash) { ensureSorted(); @@ -179,6 +181,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { * <strong>Note that this implementation allows insertion of two blocks with same index for one resource.</strong> * </p> */ + @Override public void insert(Block block) { sorted = false; ensureCapacity(); @@ -257,6 +260,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { } private final DataUtils.Sortable byBlockHash = new DataUtils.Sortable() { + @Override public void swap(int i, int j) { String tmp = resourceIds[i]; resourceIds[i] = resourceIds[j]; @@ -271,28 +275,33 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { } } + @Override public boolean isLess(int i, int j) { return isLessByHash(i, j); } + @Override public int size() { return size; } }; private final DataUtils.Sortable byResourceId = new DataUtils.Sortable() { + @Override public void swap(int i, int j) { int tmp = resourceIdsIndex[i]; resourceIdsIndex[i] = resourceIdsIndex[j]; resourceIdsIndex[j] = tmp; } + @Override public boolean isLess(int i, int j) { String s1 = resourceIds[resourceIdsIndex[i]]; String s2 = resourceIds[resourceIdsIndex[j]]; return FastStringComparator.INSTANCE.compare(s1, s2) < 0; } + @Override public int size() { return size; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java b/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java index d8f5a304af9..bb826686774 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java @@ -50,6 +50,7 @@ public class TokensLine implements CodeFragment { return value; } + @Override public int getStartLine() { return startLine; } @@ -57,6 +58,7 @@ public class TokensLine implements CodeFragment { /** * Same as {@link #getStartLine()} */ + @Override public int getEndLine() { return startLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java index 361c51cf112..49e9e90f743 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java @@ -54,10 +54,12 @@ public class Statement implements CodeFragment { this.endLine = tokens.get(tokens.size() - 1).getLine(); } + @Override public int getStartLine() { return startLine; } + @Override public int getEndLine() { return endLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java b/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java index e1ad2e8da24..433238f3db4 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java @@ -72,6 +72,7 @@ public class TokenQueue implements Iterable<Token> { return nextToken.getValue().equals(expectedValue); } + @Override public Iterator<Token> iterator() { return tokenQueue.iterator(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java b/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java index d216e37656c..7b80a850280 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java @@ -33,6 +33,7 @@ public final class FastStringComparator implements Comparator<String> { /** * Compares two strings (not lexicographically). */ + @Override public int compare(String s1, String s2) { if (s1 == s2) { // NOSONAR false-positive: Compare Objects With Equals return 0; diff --git a/sonar-graph/src/main/java/org/sonar/graph/DirectedGraph.java b/sonar-graph/src/main/java/org/sonar/graph/DirectedGraph.java index 6372ba01095..ecbb0fb6d72 100644 --- a/sonar-graph/src/main/java/org/sonar/graph/DirectedGraph.java +++ b/sonar-graph/src/main/java/org/sonar/graph/DirectedGraph.java @@ -84,6 +84,7 @@ public class DirectedGraph<V, E extends Edge<V>> implements DirectedGraphAccesso edges.put(vertexKey2, edge); } + @Override public E getEdge(V from, V to) { Map<V, E> outgoingEdgesFrom = outgoingEdgesByVertex.get(from); if (outgoingEdgesFrom == null) { @@ -93,6 +94,7 @@ public class DirectedGraph<V, E extends Edge<V>> implements DirectedGraphAccesso } } + @Override public boolean hasEdge(V from, V to) { Map<V, E> outgoingEdges = outgoingEdgesByVertex.get(from); if (outgoingEdges == null) { @@ -111,6 +113,7 @@ public class DirectedGraph<V, E extends Edge<V>> implements DirectedGraphAccesso } } + @Override public Set<V> getVertices() { return vertices; } @@ -126,6 +129,7 @@ public class DirectedGraph<V, E extends Edge<V>> implements DirectedGraphAccesso return result; } + @Override public Collection<E> getOutgoingEdges(V from) { Map<V, E> outgoingEdges = outgoingEdgesByVertex.get(from); if (outgoingEdges == null) { @@ -134,6 +138,7 @@ public class DirectedGraph<V, E extends Edge<V>> implements DirectedGraphAccesso return outgoingEdges.values(); } + @Override public Collection<E> getIncomingEdges(V to) { Map<V, E> incomingEdges = incomingEdgesByVertex.get(to); if (incomingEdges == null) { diff --git a/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java b/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java index 43125a0e932..81de9669e43 100644 --- a/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java +++ b/sonar-graph/src/main/java/org/sonar/graph/FeedbackCycle.java @@ -87,10 +87,12 @@ public final class FeedbackCycle implements Iterable<FeedbackEdge>, Comparable<F return totalOccurrencesOfEdgesInCycle; } + @Override public Iterator<FeedbackEdge> iterator() { return orderedFeedbackEdges.iterator(); } + @Override public int compareTo(FeedbackCycle feedbackCycle) { if (getTotalOccurrencesOfEdgesInCycle() < feedbackCycle.getTotalOccurrencesOfEdgesInCycle()) {//NOSONAR this class has a natural ordering that is inconsistent with equals return -1; diff --git a/sonar-graph/src/main/java/org/sonar/graph/FeedbackEdge.java b/sonar-graph/src/main/java/org/sonar/graph/FeedbackEdge.java index 529efe8bda2..6e24a466058 100644 --- a/sonar-graph/src/main/java/org/sonar/graph/FeedbackEdge.java +++ b/sonar-graph/src/main/java/org/sonar/graph/FeedbackEdge.java @@ -51,6 +51,7 @@ public class FeedbackEdge implements Comparable<FeedbackEdge> { return occurences; } + @Override public int compareTo(FeedbackEdge feedbackEdge) { if (this.getRelativeWeight() < feedbackEdge.getRelativeWeight()) { return -1; diff --git a/sonar-graph/src/main/java/org/sonar/graph/StringEdge.java b/sonar-graph/src/main/java/org/sonar/graph/StringEdge.java index 11168ca8663..c5aa7bb1844 100644 --- a/sonar-graph/src/main/java/org/sonar/graph/StringEdge.java +++ b/sonar-graph/src/main/java/org/sonar/graph/StringEdge.java @@ -38,14 +38,17 @@ public class StringEdge implements Edge<String> { this.weight = weight; } + @Override public String getFrom() { return from; } + @Override public String getTo() { return to; } + @Override public int getWeight() { return weight; } diff --git a/sonar-graph/src/main/java/org/sonar/graph/StringEdgeFactory.java b/sonar-graph/src/main/java/org/sonar/graph/StringEdgeFactory.java index 7d77959d996..a7dd4dee50c 100644 --- a/sonar-graph/src/main/java/org/sonar/graph/StringEdgeFactory.java +++ b/sonar-graph/src/main/java/org/sonar/graph/StringEdgeFactory.java @@ -21,10 +21,12 @@ package org.sonar.graph; public class StringEdgeFactory implements EdgeFactory<String, StringEdge> { + @Override public StringEdge createEdge(String from, String to) { return new StringEdge(from, to); } + @Override public StringEdge createEdge(String from, String to, int weight) { return new StringEdge(from, to, weight); } diff --git a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java index 37a81e17fcf..090546c21cf 100644 --- a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java +++ b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java @@ -209,6 +209,7 @@ public class FileCache { } private static final class LibFilter implements ZipUtils.ZipEntryFilter { + @Override public boolean accept(ZipEntry entry) { return entry.getName().startsWith("META-INF/lib"); } diff --git a/sonar-home/src/main/java/org/sonar/home/log/Slf4jLog.java b/sonar-home/src/main/java/org/sonar/home/log/Slf4jLog.java index e63be97f658..03ff7029ff8 100644 --- a/sonar-home/src/main/java/org/sonar/home/log/Slf4jLog.java +++ b/sonar-home/src/main/java/org/sonar/home/log/Slf4jLog.java @@ -38,18 +38,22 @@ public class Slf4jLog implements Log { return logger.isDebugEnabled(); } + @Override public void debug(String s) { logger.debug(s); } + @Override public void info(String s) { logger.info(s); } + @Override public void warn(String s) { logger.warn(s); } + @Override public void error(String s, Throwable throwable) { logger.error(s, throwable); } diff --git a/sonar-home/src/main/java/org/sonar/home/log/StandardLog.java b/sonar-home/src/main/java/org/sonar/home/log/StandardLog.java index bd221faf7c7..fa4402d15ca 100644 --- a/sonar-home/src/main/java/org/sonar/home/log/StandardLog.java +++ b/sonar-home/src/main/java/org/sonar/home/log/StandardLog.java @@ -20,15 +20,19 @@ package org.sonar.home.log; public class StandardLog implements Log { + @Override public void debug(String s) { } + @Override public void info(String s) { } + @Override public void warn(String s) { } + @Override public void error(String s, Throwable throwable) { } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java index c66422b6467..31f2f349abe 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java @@ -29,14 +29,17 @@ package org.sonar.api; */ public abstract class SonarPlugin implements Plugin { + @Override public final String getKey() { throw new UnsupportedOperationException(); } + @Override public final String getName() { throw new UnsupportedOperationException(); } + @Override public final String getDescription() { throw new UnsupportedOperationException(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCpdMapping.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCpdMapping.java index 902680daaeb..cc06f66d749 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCpdMapping.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCpdMapping.java @@ -33,6 +33,7 @@ public abstract class AbstractCpdMapping implements CpdMapping { /** * {@inheritDoc} */ + @Override public Resource createResource(java.io.File file, List<java.io.File> sourceDirs) { throw new UnsupportedOperationException("Deprecated since 4.2"); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractDivisionDecorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractDivisionDecorator.java index 8e0fb2beac0..82fa6e9fade 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractDivisionDecorator.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractDivisionDecorator.java @@ -60,6 +60,7 @@ public abstract class AbstractDivisionDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -67,6 +68,7 @@ public abstract class AbstractDivisionDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public void decorate(Resource resource, DecoratorContext context) { if (!shouldDecorateResource(context)) { return; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractSumChildrenDecorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractSumChildrenDecorator.java index 3c63e79c51e..0a933ad0f09 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractSumChildrenDecorator.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractSumChildrenDecorator.java @@ -49,6 +49,7 @@ public abstract class AbstractSumChildrenDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public boolean shouldExecuteOnProject(Project project) { return true; } @@ -61,6 +62,7 @@ public abstract class AbstractSumChildrenDecorator implements Decorator { /** * {@inheritDoc} */ + @Override public void decorate(Resource resource, DecoratorContext context) { if (!shouldDecorateResource(resource)) { return; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaContext.java index c1565281ef1..766652028ed 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaContext.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaContext.java @@ -35,10 +35,12 @@ public class DefaultFormulaContext implements FormulaContext { this.metric = metric; } + @Override public Metric getTargetMetric() { return metric; } + @Override public Resource getResource() { return decoratorContext.getResource(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaData.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaData.java index 1b30cf158e5..6cff32c4d1a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaData.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DefaultFormulaData.java @@ -39,22 +39,27 @@ public class DefaultFormulaData implements FormulaData { this.decoratorContext = decoratorContext; } + @Override public Measure getMeasure(Metric metric) { return decoratorContext.getMeasure(metric); } + @Override public <M> M getMeasures(MeasuresFilter<M> filter) { return decoratorContext.getMeasures(filter); } + @Override public Collection<Measure> getChildrenMeasures(MeasuresFilter filter) { return decoratorContext.getChildrenMeasures(filter); } + @Override public Collection<Measure> getChildrenMeasures(Metric metric) { return decoratorContext.getChildrenMeasures(metric); } + @Override public Collection<FormulaData> getChildren() { List<FormulaData> result = Lists.newArrayList(); for (DecoratorContext childContext : decoratorContext.getChildren()) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java index ff03fef001e..a530f6cc954 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java @@ -36,6 +36,7 @@ import org.sonar.api.resources.Project; */ public abstract class Initializer implements BatchExtension, CheckProject { + @Override public boolean shouldExecuteOnProject(Project project) { return true; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java index c468ec371ac..9ef5ef49741 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java @@ -37,6 +37,7 @@ public class ProjectBuilderContext implements ProjectBuilder.Context { this.reactor = reactor; } + @Override public ProjectReactor projectReactor() { return reactor; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java index 8036d90a3ea..200fba843c5 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java @@ -44,6 +44,7 @@ public class DefaultFilePredicates implements FilePredicates { /** * Returns a predicate that always evaluates to true */ + @Override public FilePredicate all() { return TruePredicate.TRUE; } @@ -51,6 +52,7 @@ public class DefaultFilePredicates implements FilePredicates { /** * Returns a predicate that always evaluates to false */ + @Override public FilePredicate none() { return FalsePredicate.FALSE; } @@ -58,6 +60,7 @@ public class DefaultFilePredicates implements FilePredicates { /** * Warning - not efficient because absolute path is not indexed yet. */ + @Override public FilePredicate hasAbsolutePath(String s) { return new AbsolutePathPredicate(s); } @@ -65,14 +68,17 @@ public class DefaultFilePredicates implements FilePredicates { /** * TODO document that non-normalized path and Windows-style path are supported */ + @Override public FilePredicate hasRelativePath(String s) { return new RelativePathPredicate(s); } + @Override public FilePredicate matchesPathPattern(String inclusionPattern) { return new PathPatternPredicate(PathPattern.create(inclusionPattern)); } + @Override public FilePredicate matchesPathPatterns(String[] inclusionPatterns) { if (inclusionPatterns.length == 0) { return TruePredicate.TRUE; @@ -84,10 +90,12 @@ public class DefaultFilePredicates implements FilePredicates { return or(predicates); } + @Override public FilePredicate doesNotMatchPathPattern(String exclusionPattern) { return not(matchesPathPattern(exclusionPattern)); } + @Override public FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns) { if (exclusionPatterns.length == 0) { return TruePredicate.TRUE; @@ -95,6 +103,7 @@ public class DefaultFilePredicates implements FilePredicates { return not(matchesPathPatterns(exclusionPatterns)); } + @Override public FilePredicate hasPath(String s) { File file = new File(s); if (file.isAbsolute()) { @@ -103,6 +112,7 @@ public class DefaultFilePredicates implements FilePredicates { return hasRelativePath(s); } + @Override public FilePredicate is(File ioFile) { if (ioFile.isAbsolute()) { return hasAbsolutePath(ioFile.getAbsolutePath()); @@ -110,10 +120,12 @@ public class DefaultFilePredicates implements FilePredicates { return hasRelativePath(ioFile.getPath()); } + @Override public FilePredicate hasLanguage(String language) { return new LanguagePredicate(language); } + @Override public FilePredicate hasLanguages(Collection<String> languages) { List<FilePredicate> list = new ArrayList<FilePredicate>(); for (String language : languages) { @@ -122,6 +134,7 @@ public class DefaultFilePredicates implements FilePredicates { return or(list); } + @Override public FilePredicate hasLanguages(String... languages) { List<FilePredicate> list = new ArrayList<FilePredicate>(); for (String language : languages) { @@ -130,38 +143,47 @@ public class DefaultFilePredicates implements FilePredicates { return or(list); } + @Override public FilePredicate hasStatus(InputFile.Status status) { return new StatusPredicate(status); } + @Override public FilePredicate hasType(InputFile.Type type) { return new TypePredicate(type); } + @Override public FilePredicate not(FilePredicate p) { return new NotPredicate(p); } + @Override public FilePredicate or(Collection<FilePredicate> or) { return new OrPredicate(or); } + @Override public FilePredicate or(FilePredicate... or) { return new OrPredicate(Arrays.asList(or)); } + @Override public FilePredicate or(FilePredicate first, FilePredicate second) { return new OrPredicate(Arrays.asList(first, second)); } + @Override public FilePredicate and(Collection<FilePredicate> and) { return new AndPredicate(and); } + @Override public FilePredicate and(FilePredicate... and) { return new AndPredicate(Arrays.asList(and)); } + @Override public FilePredicate and(FilePredicate first, FilePredicate second) { return new AndPredicate(Arrays.asList(first, second)); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java index d4723e1627e..cc1725013c9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRuleParam.java @@ -34,10 +34,12 @@ class DefaultRuleParam implements RuleParam { this.description = p.description; } + @Override public String key() { return key; } + @Override @Nullable public String description() { return description; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/test/internal/DefaultTestCase.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/test/internal/DefaultTestCase.java index 023adec8106..100b0545980 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/test/internal/DefaultTestCase.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/test/internal/DefaultTestCase.java @@ -99,6 +99,7 @@ public class DefaultTestCase implements TestCase { return this; } + @Override public InputFile testFile() { return testFile; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/component/mock/MockSourceFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/component/mock/MockSourceFile.java index 61422d00169..7388ff7b2aa 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/component/mock/MockSourceFile.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/component/mock/MockSourceFile.java @@ -32,6 +32,7 @@ public class MockSourceFile implements SourceFile { private MockSourceFile() { } + @Override public String key() { return key; } @@ -51,6 +52,7 @@ public class MockSourceFile implements SourceFile { return this; } + @Override public String qualifier() { return qualifier; } @@ -69,6 +71,7 @@ public class MockSourceFile implements SourceFile { return this; } + @Override public String name() { return name; } @@ -78,6 +81,7 @@ public class MockSourceFile implements SourceFile { return this; } + @Override public String longName() { return longName; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java b/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java index c2044cded2a..5b7537f20da 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/design/Dependency.java @@ -45,10 +45,12 @@ public class Dependency implements Edge<Resource> { this.to = to; } + @Override public Resource getFrom() { return from; } + @Override public Resource getTo() { return to; } @@ -62,6 +64,7 @@ public class Dependency implements Edge<Resource> { return this; } + @Override public int getWeight() { return weight; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java index 14aabc2b3f9..ab5f23e203a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssue.java @@ -103,6 +103,7 @@ public class DefaultIssue implements Issue { // Date when issue was loaded from db (only when isNew=false) private Date selectedAt; + @Override public String key() { return key; } @@ -112,6 +113,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public String componentKey() { return componentKey; } @@ -134,6 +136,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public String projectKey() { return projectKey; } @@ -143,6 +146,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public RuleKey ruleKey() { return ruleKey; } @@ -152,6 +156,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public String language() { return language; } @@ -161,6 +166,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public String severity() { return severity; } @@ -180,6 +186,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String message() { return message; @@ -190,6 +197,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public Integer line() { return line; @@ -201,6 +209,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public Double effortToFix() { return effortToFix; @@ -215,6 +224,7 @@ public class DefaultIssue implements Issue { /** * Elapsed time to fix the issue */ + @Override @CheckForNull public Duration debt() { return debt; @@ -230,6 +240,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public String status() { return status; } @@ -240,6 +251,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String resolution() { return resolution; @@ -250,6 +262,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String reporter() { return reporter; @@ -260,6 +273,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String assignee() { return assignee; @@ -270,6 +284,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public Date creationDate() { return creationDate; } @@ -280,6 +295,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public Date updateDate() { return updateDate; @@ -290,6 +306,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public Date closeDate() { return closeDate; @@ -364,6 +381,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String attribute(String key) { return attributes == null ? null : attributes.get(key); @@ -381,6 +399,7 @@ public class DefaultIssue implements Issue { return this; } + @Override public Map<String, String> attributes() { return attributes == null ? Collections.<String, String>emptyMap() : ImmutableMap.copyOf(attributes); } @@ -395,6 +414,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String authorLogin() { return authorLogin; @@ -405,6 +425,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @CheckForNull public String actionPlanKey() { return actionPlanKey; @@ -461,6 +482,7 @@ public class DefaultIssue implements Issue { return this; } + @Override @SuppressWarnings("unchcked") public List<IssueComment> comments() { if (comments == null) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssueComment.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssueComment.java index 6943d28dce6..dbff36ff056 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssueComment.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/internal/DefaultIssueComment.java @@ -52,6 +52,7 @@ public class DefaultIssueComment implements Serializable, IssueComment { return this; } + @Override public String issueKey() { return issueKey; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java index 0941f4e37a9..64283bfdce1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/AverageFormula.java @@ -71,6 +71,7 @@ public class AverageFormula implements Formula { /** * {@inheritDoc} */ + @Override public List<Metric> dependsUponMetrics() { return fallbackMetric != null ? newArrayList(mainMetric, fallbackMetric, byMetric) : newArrayList(mainMetric, byMetric); } @@ -78,6 +79,7 @@ public class AverageFormula implements Formula { /** * {@inheritDoc} */ + @Override public Measure calculate(FormulaData data, FormulaContext context) { if (!shouldDecorateResource(data, context)) { return null; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CountDistributionBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CountDistributionBuilder.java index aa05235a37a..528d62312de 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CountDistributionBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CountDistributionBuilder.java @@ -140,6 +140,7 @@ public class CountDistributionBuilder implements MeasureBuilder { * * @return the built measure */ + @Override public Measure build() { return build(true); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java index f999eb2ccf4..b679a6cc034 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeanAggregationFormula.java @@ -38,10 +38,12 @@ public class MeanAggregationFormula implements Formula { this(false); } + @Override public List<Metric> dependsUponMetrics() { return Collections.emptyList(); } + @Override public Measure calculate(FormulaData data, FormulaContext context) { double sum=0.0; int count=0; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java index 7a8e905f8ed..0fc4f93519c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java @@ -208,6 +208,7 @@ public class RangeDistributionBuilder implements MeasureBuilder { * * @return the built measure */ + @Override public Measure<String> build() { return build(true); } @@ -226,6 +227,7 @@ public class RangeDistributionBuilder implements MeasureBuilder { } private class RangeTransformer implements Transformer { + @Override public Object transform(Object o) { Number n = (Number) o; for (int i = bottomLimits.length - 1; i >= 0; i--) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildDistributionFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildDistributionFormula.java index b853fe1dc42..f00edfad56f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildDistributionFormula.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildDistributionFormula.java @@ -34,6 +34,7 @@ public class SumChildDistributionFormula implements Formula { private String minimumScopeToPersist= Scopes.FILE; + @Override public List<Metric> dependsUponMetrics() { return Collections.emptyList(); } @@ -47,6 +48,7 @@ public class SumChildDistributionFormula implements Formula { return this; } + @Override public Measure calculate(FormulaData data, FormulaContext context) { Collection<Measure> measures = data.getChildrenMeasures(context.getTargetMetric()); if (measures == null || measures.isEmpty()) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildValuesFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildValuesFormula.java index b954b9d9ce1..a81d7e0bac4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildValuesFormula.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/SumChildValuesFormula.java @@ -33,10 +33,12 @@ public class SumChildValuesFormula implements Formula { this.saveZeroIfNoChildValues = saveZeroIfNoChildValues; } + @Override public List<Metric> dependsUponMetrics() { return Collections.emptyList(); } + @Override public Measure calculate(FormulaData data, FormulaContext context) { Double sum = MeasureUtils.sum(saveZeroIfNoChildValues, data.getChildrenMeasures(context.getTargetMetric())); if (sum != null) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java index 3553d47ee89..61f4d7ccbae 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/WeightedMeanAggregationFormula.java @@ -38,10 +38,12 @@ public class WeightedMeanAggregationFormula implements Formula { this.zeroIfNoValues = zeroIfNoValues; } + @Override public List<Metric> dependsUponMetrics() { return Collections.emptyList(); } + @Override public Measure calculate(FormulaData data, FormulaContext context) { double sum=0.0; double count=0.0; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java index 795eb19a465..45b4053dbfe 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java @@ -349,6 +349,7 @@ public class RulesProfile implements Cloneable { clone.setParentName(getParentName()); if (activeRules != null && !activeRules.isEmpty()) { clone.setActiveRules(new ArrayList<ActiveRule>(CollectionUtils.collect(activeRules, new Transformer() { + @Override public Object transform(Object input) { return ((ActiveRule) input).clone(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java index c2f7ec78bd9..8cd32fad761 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java @@ -56,6 +56,7 @@ public abstract class AbstractLanguage implements Language { /** * {@inheritDoc} */ + @Override public String getKey() { return key; } @@ -63,6 +64,7 @@ public abstract class AbstractLanguage implements Language { /** * {@inheritDoc} */ + @Override public String getName() { return name; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java index d8f49ceb201..51a6cde057e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java @@ -121,10 +121,12 @@ public final class InputFileUtils { this.relativePath = relativePath; } + @Override public java.io.File getFileBaseDir() { return basedir; } + @Override public java.io.File getFile() { return new java.io.File(basedir, relativePath); } @@ -132,10 +134,12 @@ public final class InputFileUtils { /** * @since 3.1 */ + @Override public InputStream getInputStream() throws FileNotFoundException { return new BufferedInputStream(new FileInputStream(getFile())); } + @Override public String getRelativePath() { return relativePath; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java index 6d5e3cf6a8e..7ee68787081 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java @@ -60,6 +60,7 @@ public class ResourceTypeTree implements TaskExtension, ServerExtension { public List<String> getLeaves() { return ImmutableList.copyOf(Collections2.filter(relations.values(), new Predicate<String>() { + @Override public boolean apply(String qualifier) { return relations.get(qualifier).isEmpty(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java index e76995c9ed4..5fcf4e934d3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java @@ -47,6 +47,7 @@ import java.util.Map; public class ResourceTypes implements TaskComponent, ServerComponent { public static final Predicate<ResourceType> AVAILABLE_FOR_FILTERS = new Predicate<ResourceType>() { + @Override public boolean apply(@Nullable ResourceType input) { return input != null && input.getBooleanProperty("supportsMeasureFilters"); } @@ -102,6 +103,7 @@ public class ResourceTypes implements TaskComponent, ServerComponent { this.propertyKey = propertyKey; } + @Override public boolean apply(@Nullable ResourceType input) { return input != null && input.hasProperty(propertyKey); } @@ -120,6 +122,7 @@ public class ResourceTypes implements TaskComponent, ServerComponent { this.propertyKey = propertyKey; } + @Override public boolean apply(@Nullable ResourceType input) { return input != null && Objects.equal(propertyValue, input.getStringProperty(propertyKey)); } @@ -138,6 +141,7 @@ public class ResourceTypes implements TaskComponent, ServerComponent { this.propertyValue = propertyValue; } + @Override public boolean apply(@Nullable ResourceType input) { return input != null && input.getBooleanProperty(propertyKey) == propertyValue; } @@ -157,6 +161,7 @@ public class ResourceTypes implements TaskComponent, ServerComponent { public List<ResourceType> getChildren(String qualifier) { return Lists.transform(getChildrenQualifiers(qualifier), new Function<String, ResourceType>() { + @Override public ResourceType apply(String s) { return typeByQualifier.get(s); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java index 42da994a956..db4653f8a1a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java @@ -294,6 +294,7 @@ public class ActiveRule implements Cloneable { clone.setInheritance(getInheritance()); if (CollectionUtils.isNotEmpty(getActiveRuleParams())) { clone.setActiveRuleParams(new ArrayList<ActiveRuleParam>(CollectionUtils.collect(getActiveRuleParams(), new Transformer() { + @Override public Object transform(Object input) { ActiveRuleParam activeRuleParamClone = (ActiveRuleParam) ((ActiveRuleParam) input).clone(); activeRuleParamClone.setActiveRule(clone); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java index 1a77b6d0ca9..446b7691dbd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java @@ -47,6 +47,7 @@ public abstract class ValidatingRequest extends Request { return action; } + @Override @CheckForNull public String param(String key) { return param(key, true); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java index 98601666328..15dbe6cb28f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java @@ -84,6 +84,7 @@ public class TaskDefinition implements TaskExtension, Comparable<TaskDefinition> return key.hashCode(); } + @Override public int compareTo(TaskDefinition o) { return key.compareTo(o.key); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristic.java index 1f0beba8d2c..c5a4e4a702b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristic.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristic.java @@ -56,6 +56,7 @@ public class DefaultCharacteristic implements Characteristic { this.requirements = newArrayList(); } + @Override public Integer id() { return id; } @@ -65,6 +66,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override public String key() { return key; } @@ -74,6 +76,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override public String name() { return name; } @@ -92,6 +95,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public Integer order() { return order; @@ -102,6 +106,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public DefaultCharacteristic parent() { return parent; @@ -125,6 +130,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override public List<DefaultCharacteristic> children() { return children; } @@ -143,10 +149,12 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override public boolean isRoot() { return parent == null; } + @Override public Date createdAt() { return createdAt; } @@ -156,6 +164,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public Date updatedAt() { return updatedAt; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java index 64f90b24cd2..8d0a49c5a56 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/internal/DefaultRequirement.java @@ -56,6 +56,7 @@ public class DefaultRequirement implements Requirement { private Date createdAt; private Date updatedAt; + @Override public Integer id() { return id; } @@ -65,6 +66,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public RuleKey ruleKey() { return ruleKey; } @@ -74,6 +76,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public DefaultCharacteristic characteristic() { return characteristic; } @@ -84,6 +87,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public DefaultCharacteristic rootCharacteristic() { return rootCharacteristic; } @@ -93,6 +97,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public String function() { return function; } @@ -105,6 +110,7 @@ public class DefaultRequirement implements Requirement { /** * @deprecated since 4.2 */ + @Override @Deprecated public WorkUnit factor() { return WorkUnit.create((double) factorValue, fromUnit(factorUnit)); @@ -120,6 +126,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public int factorValue() { return factorValue; } @@ -129,6 +136,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override @CheckForNull public WorkDuration.UNIT factorUnit() { return factorUnit; @@ -142,6 +150,7 @@ public class DefaultRequirement implements Requirement { /** * @deprecated since 4.2 */ + @Override @Deprecated public WorkUnit offset() { return WorkUnit.create((double) offsetValue, fromUnit(offsetUnit)); @@ -157,6 +166,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public int offsetValue() { return offsetValue; } @@ -166,6 +176,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override @CheckForNull public WorkDuration.UNIT offsetUnit() { return offsetUnit; @@ -176,6 +187,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public Date createdAt() { return createdAt; } @@ -185,6 +197,7 @@ public class DefaultRequirement implements Requirement { return this; } + @Override public Date updatedAt() { return updatedAt; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java index 1c49df8a662..de351f51a51 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java @@ -50,6 +50,7 @@ public class DefaultCharacteristic implements Characteristic { private Integer offsetValue; private WorkDuration.UNIT offsetUnit; + @Override public Integer id() { return id; } @@ -59,6 +60,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public String key() { return key; @@ -69,6 +71,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public String name() { return name; @@ -79,6 +82,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public Integer order() { return order; @@ -89,6 +93,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public Integer parentId() { return parentId; @@ -99,6 +104,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public Integer rootId() { return rootId; @@ -112,6 +118,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.2 */ + @Override @Deprecated @CheckForNull public RuleKey ruleKey() { @@ -130,6 +137,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.2 */ + @Override @Deprecated @CheckForNull public String function() { @@ -148,6 +156,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.2 */ + @Override @Deprecated @CheckForNull public WorkUnit factor() { @@ -172,6 +181,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.3 */ + @Override @Deprecated @CheckForNull public Integer factorValue() { @@ -187,6 +197,7 @@ public class DefaultCharacteristic implements Characteristic { return this; } + @Override @CheckForNull public WorkDuration.UNIT factorUnit() { return factorUnit; @@ -204,6 +215,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.2 */ + @Override @Deprecated public WorkUnit offset() { if (offsetValue != null && offsetUnit != null) { @@ -227,6 +239,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.3 */ + @Override @Deprecated @CheckForNull public Integer offsetValue() { @@ -245,6 +258,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.3 */ + @Override @Deprecated @CheckForNull public WorkDuration.UNIT offsetUnit() { @@ -289,6 +303,7 @@ public class DefaultCharacteristic implements Characteristic { throw new IllegalStateException("Invalid unit : " + unit); } + @Override public boolean isRoot() { return parentId == null; } @@ -296,6 +311,7 @@ public class DefaultCharacteristic implements Characteristic { /** * @deprecated since 4.3 */ + @Override @Deprecated public boolean isRequirement() { return ruleKey != null; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java index c2110a2b365..e7b29cad25f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java @@ -268,6 +268,7 @@ public class HttpDownloader extends UriReader.SchemeProcessor implements BatchCo this.readTimeoutMillis = readTimeoutMillis; } + @Override public InputStream getInput() throws IOException { LoggerFactory.getLogger(getClass()).debug("Download: " + uri + " (" + getProxySynthesis(uri, ProxySelector.getDefault()) + ")"); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpsTrust.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpsTrust.java index 5f25ced59b6..3ca747135d1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpsTrust.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpsTrust.java @@ -73,6 +73,7 @@ class HttpsTrust { */ private HostnameVerifier createHostnameVerifier() { return new HostnameVerifier() { + @Override public boolean verify(String hostname, SSLSession session) { return true; } @@ -80,14 +81,17 @@ class HttpsTrust { } static class AlwaysTrustManager implements X509TrustManager { + @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } + @Override public void checkClientTrusted(X509Certificate[] chain, String authType) { // Do not check } + @Override public void checkServerTrusted(X509Certificate[] chain, String authType) { // Do not check } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java index f4e5cb7a889..45e144bd0b4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java @@ -489,6 +489,7 @@ public final class KeyValueFormat { */ @Deprecated public static class StringNumberPairTransformer implements Transformer<String, Double> { + @Override public KeyValue<String, Double> transform(String key, String value) { return new KeyValue<String, Double>(key, toDouble(value)); } @@ -501,6 +502,7 @@ public final class KeyValueFormat { */ @Deprecated public static class DoubleNumbersPairTransformer implements Transformer<Double, Double> { + @Override public KeyValue<Double, Double> transform(String key, String value) { return new KeyValue<Double, Double>(toDouble(key), toDouble(value)); } @@ -513,6 +515,7 @@ public final class KeyValueFormat { */ @Deprecated public static class IntegerNumbersPairTransformer implements Transformer<Integer, Integer> { + @Override public KeyValue<Integer, Integer> transform(String key, String value) { return new KeyValue<Integer, Integer>(toInteger(key), toInteger(value)); } @@ -527,6 +530,7 @@ public final class KeyValueFormat { @Deprecated public static class RulePriorityNumbersPairTransformer implements Transformer<RulePriority, Integer> { + @Override public KeyValue<RulePriority, Integer> transform(String key, String value) { try { if (StringUtils.isBlank(value)) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java index dd7a3895a1a..55df7e312ee 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java @@ -113,10 +113,12 @@ public class LocalizedMessages extends ResourceBundle { i = keys.iterator(); } + @Override public boolean hasMoreElements() { return i.hasNext(); } + @Override public String nextElement() { return i.next(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java index 4532121e935..8c214218206 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/StaxParser.java @@ -113,6 +113,7 @@ public class StaxParser { } private static class UndeclaredEntitiesXMLResolver implements XMLResolver { + @Override public Object resolveEntity(String arg0, String arg1, String fileName, String undeclaredEntity) throws XMLStreamException { // avoid problems with XML docs containing undeclared entities.. return the entity under its raw form if not an unicode expression if (StringUtils.startsWithIgnoreCase(undeclaredEntity, "u") && undeclaredEntity.length() == 5) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java index 885905a4b58..598661e9b21 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java @@ -52,6 +52,7 @@ public final class ZipUtils { */ public static File unzip(File zip, File toDir) throws IOException { unzip(zip, toDir, new ZipEntryFilter() { + @Override public boolean accept(ZipEntry entry) { return true; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java index d95d3234718..ad079758ee7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java @@ -201,6 +201,7 @@ public class CommandExecutor { } private static class DefaultConsumer implements StreamConsumer { + @Override public void consumeLine(String line) { LOG.info(line); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java index 48573c4fd41..db391a688f0 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java @@ -84,6 +84,7 @@ public class Node implements Comparable<Node> { return dependencies; } + @Override public int compareTo(final Node other) { int orderInd = 0; diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java index f3d31a1f72b..6e6737c4045 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java +++ b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java @@ -45,6 +45,7 @@ public class BundleSynchronizedMatcher extends BaseMatcher<String> { private SortedMap<String, String> missingKeys; private SortedMap<String, String> additionalKeys; + @Override public boolean matches(Object arg0) { if (!(arg0 instanceof String)) { return false; @@ -78,6 +79,7 @@ public class BundleSynchronizedMatcher extends BaseMatcher<String> { } } + @Override public void describeTo(Description description) { // report file File dumpFile = new File("target/l10n/" + bundleName + ".report.txt"); |