aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl/src/main
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-09-15 13:49:31 -0500
committersonartech <sonartech@sonarsource.com>2022-09-16 20:03:14 +0000
commitf51e80efde03d0af839d4991a31300f0f36088d3 (patch)
tree7c9f36e736e1ab83714c92512df0790242e4ca14 /sonar-plugin-api-impl/src/main
parent227f5d3bfc797c8ecc7ebe7e283af3b68522c1ad (diff)
downloadsonarqube-f51e80efde03d0af839d4991a31300f0f36088d3.tar.gz
sonarqube-f51e80efde03d0af839d4991a31300f0f36088d3.zip
SONAR-17287 Fix quality issues and adopt changes to API
Diffstat (limited to 'sonar-plugin-api-impl/src/main')
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/AbstractDefaultIssue.java16
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueFlow.java15
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;
- }
}