diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-10 00:01:22 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-10 00:01:23 +0200 |
commit | 736c775bfc2cde38a53e4d43f858d3a3b6728c34 (patch) | |
tree | caee18e0a6007e19e8ee81d64a2b1e8dfe17a847 /sonar-plugin-api/src/main/java | |
parent | 7d562d641868532e5edbd6f03fac739eff9bcc90 (diff) | |
download | sonarqube-736c775bfc2cde38a53e4d43f858d3a3b6728c34.tar.gz sonarqube-736c775bfc2cde38a53e4d43f858d3a3b6728c34.zip |
Add missing @Override annotations
Diffstat (limited to 'sonar-plugin-api/src/main/java')
41 files changed, 154 insertions, 0 deletions
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; |