aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main/java/org/sonar/api
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-14 12:01:30 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-14 12:01:38 +0100
commit6fad9a863175e5c44ad9f1452fb8af13a70af4e5 (patch)
tree1801ac7294e8cff4c13bd90535fcebcd4656d005 /sonar-plugin-api/src/main/java/org/sonar/api
parent2135b8bb236fc67d3af992bbef69dcbe7df42376 (diff)
downloadsonarqube-6fad9a863175e5c44ad9f1452fb8af13a70af4e5.tar.gz
sonarqube-6fad9a863175e5c44ad9f1452fb8af13a70af4e5.zip
SONAR-5141 Improve performance of technical debt measures decorator
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRules.java16
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java6
3 files changed, 6 insertions, 18 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
index 2a2ff644f32..14fb6cb7ac3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
@@ -39,6 +39,4 @@ public interface Rules {
Collection<Rule> findByRepository(String repository);
- Collection<Rule> findWithDebt();
-
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRules.java
index 20de45fd89f..3c14387a31c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRules.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRules.java
@@ -31,16 +31,12 @@ import javax.annotation.concurrent.Immutable;
import java.util.Collection;
import java.util.List;
-import static com.google.common.collect.Lists.newArrayList;
-
@Immutable
class DefaultRules implements Rules {
// TODO use disk-backed cache (persistit) instead of full in-memory cache ?
private final ListMultimap<String, Rule> rulesByRepository;
- private final Collection<Rule> rulesWithDebt;
-
DefaultRules(Collection<NewRule> newRules) {
ImmutableListMultimap.Builder<String, Rule> builder = ImmutableListMultimap.builder();
for (NewRule newRule : newRules) {
@@ -48,13 +44,6 @@ class DefaultRules implements Rules {
builder.put(r.key().repository(), r);
}
rulesByRepository = builder.build();
-
- rulesWithDebt = newArrayList();
- for (Rule rule : rulesByRepository.values()) {
- if (rule.characteristic() != null) {
- rulesWithDebt.add(rule);
- }
- }
}
@Override
@@ -77,9 +66,4 @@ class DefaultRules implements Rules {
public Collection<Rule> findByRepository(String repository) {
return rulesByRepository.get(repository);
}
-
- @Override
- public Collection<Rule> findWithDebt() {
- return rulesWithDebt;
- }
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java
index cf1b5bc1dd5..4cca21cd19f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java
@@ -21,6 +21,7 @@
package org.sonar.api.technicaldebt.batch;
import org.sonar.api.rule.RuleKey;
+import org.sonar.api.technicaldebt.batch.internal.DefaultCharacteristic;
import javax.annotation.CheckForNull;
@@ -57,4 +58,9 @@ public interface TechnicalDebtModel {
@Deprecated
List<? extends Requirement> requirements();
+ /**
+ * @since 4.3
+ */
+ List<DefaultCharacteristic> characteristics();
+
}