diff options
Diffstat (limited to 'sonar-plugin-api-impl/src/main')
2 files changed, 13 insertions, 18 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/AbstractDefaultIssue.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/AbstractDefaultIssue.java index 2fa3235e7c5..cc77d90a02f 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/AbstractDefaultIssue.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/AbstractDefaultIssue.java @@ -34,7 +34,7 @@ import org.sonar.api.batch.sensor.internal.DefaultStorable; import org.sonar.api.batch.sensor.internal.SensorStorage; import org.sonar.api.batch.sensor.issue.Issue.Flow; import org.sonar.api.batch.sensor.issue.IssueLocation; -import org.sonar.api.batch.sensor.issue.NewIssue; +import org.sonar.api.batch.sensor.issue.NewIssue.FlowType; import org.sonar.api.batch.sensor.issue.NewIssueLocation; import org.sonar.api.utils.PathUtils; @@ -72,25 +72,21 @@ public abstract class AbstractDefaultIssue<T extends AbstractDefaultIssue> exten } public T addLocation(NewIssueLocation secondaryLocation) { - flows.add(new DefaultIssueFlow(List.of(rewriteLocation((DefaultIssueLocation) secondaryLocation)), DefaultIssueFlow.Type.UNDEFINED, null)); + flows.add(new DefaultIssueFlow(List.of(rewriteLocation((DefaultIssueLocation) secondaryLocation)), FlowType.UNDEFINED, null)); return (T) this; } public T addFlow(Iterable<NewIssueLocation> locations) { - return addFlow(locations, DefaultIssueFlow.Type.UNDEFINED, null); + return addFlow(locations, FlowType.UNDEFINED, null); } - public T addFlow(Iterable<NewIssueLocation> flowLocations, NewIssue.FlowType flowType, @Nullable String flowDescription) { - return addFlow(flowLocations, DefaultIssueFlow.Type.valueOf(flowType.name()), flowDescription); - } - - private T addFlow(Iterable<NewIssueLocation> locations, DefaultIssueFlow.Type type, @Nullable String description) { + public T addFlow(Iterable<NewIssueLocation> flowLocations, FlowType type, @Nullable String flowDescription) { checkArgument(type != null, "Type can't be null"); List<IssueLocation> flowAsList = new ArrayList<>(); - for (NewIssueLocation issueLocation : locations) { + for (NewIssueLocation issueLocation : flowLocations) { flowAsList.add(rewriteLocation((DefaultIssueLocation) issueLocation)); } - flows.add(new DefaultIssueFlow(flowAsList, type, description)); + flows.add(new DefaultIssueFlow(flowAsList, type, flowDescription)); return (T) this; } diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueFlow.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueFlow.java index e4aabcc85da..76a47751c51 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueFlow.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueFlow.java @@ -24,14 +24,15 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.batch.sensor.issue.Issue; import org.sonar.api.batch.sensor.issue.IssueLocation; +import org.sonar.api.batch.sensor.issue.NewIssue.FlowType; public class DefaultIssueFlow implements Issue.Flow { private final List<IssueLocation> locations; - private final Type type; + private final FlowType type; @Nullable private final String description; - public DefaultIssueFlow(List<IssueLocation> locations, Type type, @Nullable String description) { + public DefaultIssueFlow(List<IssueLocation> locations, FlowType type, @Nullable String description) { this.locations = locations; this.type = type; this.description = description; @@ -42,16 +43,14 @@ public class DefaultIssueFlow implements Issue.Flow { return locations; } - public Type getType() { + @Override + public FlowType type() { return type; } @CheckForNull - public String getDescription() { + @Override + public String description() { return description; } - - public enum Type { - UNDEFINED, DATA, EXECUTION; - } } |