diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-09-03 18:17:36 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-09-10 16:24:34 +0200 |
commit | 2cefd460a1366f37c720c01964e00bac4b577c03 (patch) | |
tree | 7c27a29635b63b9f08a82c5be23fadc099a4f3a0 /sonar-plugin-api | |
parent | fb5b91248d6e42717f66f23c79d40c91996d1194 (diff) | |
download | sonarqube-2cefd460a1366f37c720c01964e00bac4b577c03.tar.gz sonarqube-2cefd460a1366f37c720c01964e00bac4b577c03.zip |
SONAR-6052 Drop secondary locations and rename execution flow -> flow
Diffstat (limited to 'sonar-plugin-api')
4 files changed, 17 insertions, 47 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java index 563c848ce0f..98a5eb32fd8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java @@ -35,7 +35,7 @@ import org.sonar.api.rule.RuleKey; @Beta public interface Issue { - interface ExecutionFlow { + interface Flow { /** * @return Ordered list of locations for the execution flow */ @@ -66,16 +66,10 @@ public interface Issue { IssueLocation primaryLocation(); /** - * List of additional locations for this issue. + * List of flows for this issue. Can be empty. * @since 5.2 */ - List<IssueLocation> locations(); - - /** - * List of execution flows for this issue. Can be empty. - * @since 5.2 - */ - List<ExecutionFlow> executionFlows(); + List<Flow> flows(); /** * Key/value pair of attributes that are attached to the issue. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java index c156c953136..66630bf9991 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java @@ -56,17 +56,11 @@ public interface NewIssue { NewIssue at(NewIssueLocation primaryLocation); /** - * Register an additional location for this issue. + * Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue. + * It could be a path leading to the primary location. Several flows can be registered. * @since 5.2 */ - NewIssue addLocation(NewIssueLocation location); - - /** - * Register an execution flow for this issue. An execution flow is an ordered list of issue locations that help to understand the issue. - * It is usually the path leading to the primary location. Several execution flows can be registered. - * @since 5.2 - */ - NewIssue addExecutionFlow(Iterable<NewIssueLocation> flowLocations); + NewIssue addFlow(Iterable<NewIssueLocation> flowLocations); /** * Create a new location for this issue. First registered location is considered as primary location. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java index 1c623ee92f6..bed2162a7b9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java @@ -42,10 +42,10 @@ import static java.lang.String.format; public class DefaultIssue extends DefaultStorable implements Issue, NewIssue { - private static final class ToExecutionFlow implements Function<List<IssueLocation>, ExecutionFlow> { + private static final class ToFlow implements Function<List<IssueLocation>, Flow> { @Override - public ExecutionFlow apply(final List<IssueLocation> input) { - return new ExecutionFlow() { + public Flow apply(final List<IssueLocation> input) { + return new Flow() { @Override public List<IssueLocation> locations() { return ImmutableList.copyOf(input); @@ -58,8 +58,7 @@ public class DefaultIssue extends DefaultStorable implements Issue, NewIssue { private Double effortToFix; private Severity overriddenSeverity; private IssueLocation primaryLocation; - private List<IssueLocation> locations = new ArrayList<>(); - private List<List<IssueLocation>> executionFlows = new ArrayList<>(); + private List<List<IssueLocation>> flows = new ArrayList<>(); private final Map<String, String> attributes = new LinkedHashMap<>(); public DefaultIssue() { @@ -103,18 +102,12 @@ public class DefaultIssue extends DefaultStorable implements Issue, NewIssue { } @Override - public DefaultIssue addLocation(NewIssueLocation location) { - locations.add((DefaultIssueLocation) location); - return this; - } - - @Override - public DefaultIssue addExecutionFlow(Iterable<NewIssueLocation> locations) { + public DefaultIssue addFlow(Iterable<NewIssueLocation> locations) { List<IssueLocation> flowAsList = new ArrayList<>(); for (NewIssueLocation issueLocation : locations) { flowAsList.add((DefaultIssueLocation) issueLocation); } - executionFlows.add(flowAsList); + flows.add(flowAsList); return this; } @@ -150,13 +143,8 @@ public class DefaultIssue extends DefaultStorable implements Issue, NewIssue { } @Override - public List<IssueLocation> locations() { - return ImmutableList.copyOf(this.locations); - } - - @Override - public List<ExecutionFlow> executionFlows() { - return Lists.transform(this.executionFlows, new ToExecutionFlow()); + public List<Flow> flows() { + return Lists.transform(this.flows, new ToFlow()); } @Override diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java index fad75b15d28..38fe85f4a2c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issuable.java @@ -22,6 +22,7 @@ package org.sonar.api.issue; import java.util.List; import javax.annotation.Nullable; +import org.sonar.api.batch.sensor.issue.NewIssue; import org.sonar.api.batch.sensor.issue.NewIssueLocation; import org.sonar.api.component.Perspective; import org.sonar.api.rule.RuleKey; @@ -95,16 +96,9 @@ public interface Issuable extends Perspective { /** * @since 5.2 - * Register a new secondary location for this issue. + * @see NewIssue#addFlow(Iterable) */ - IssueBuilder addLocation(NewIssueLocation location); - - /** - * @since 5.2 - * Register an execution flow for this issue. An execution flow is an ordered list of issue locations that help to understand the issue. - * It is usually the path leading to the primary location. Several execution flows can be registered. - */ - IssueBuilder addExecutionFlow(Iterable<NewIssueLocation> flowLocations); + IssueBuilder addFlow(Iterable<NewIssueLocation> flowLocations); /** * Overrides the severity declared in Quality profile. Do not execute in standard use-cases. |