}
@Override
- public IssueBuilder addExecutionFlow(NewIssueLocation... flow) {
- newIssue.addExecutionFlow(flow);
+ public IssueBuilder addExecutionFlow(Iterable<NewIssueLocation> flowLocations) {
+ newIssue.addExecutionFlow(flowLocations);
return this;
}
}
@Override
- public IssueBuilder addExecutionFlow(NewIssueLocation... flow) {
+ public IssueBuilder addExecutionFlow(Iterable<NewIssueLocation> flow) {
throw unsupported();
}
boolean isEmpty();
/**
- * Return a {@link TextPointer} in the given file.
+ * Returns a {@link TextPointer} in the given file.
* @param line Line of the pointer. Start at 1.
* @param lineOffset Offset in the line. Start at 0.
* @throw {@link IllegalArgumentException} if line or offset is not valid for the given file.
+ * @since 5.2
*/
TextPointer newPointer(int line, int lineOffset);
/**
- * Return a {@link TextRange} in the given file.
+ * Returns a {@link TextRange} in the given file.
* @param start start pointer
* @param end end pointer
* @throw {@link IllegalArgumentException} if start or stop pointers are not valid for the given file.
+ * @since 5.2
*/
TextRange newRange(TextPointer start, TextPointer end);
/**
- * Return a {@link TextRange} in the given file.
+ * Returns a {@link TextRange} in the given file.
+ * <ul>
+ * <li><code>newRange(1, 0, 1, 1)</code> selects the first character at line 1</li>
+ * <li><code>newRange(1, 0, 1, 10)</code> selects the 10 first characters at line 1</li>
+ * </ul>
* @throw {@link IllegalArgumentException} if start or stop positions are not valid for the given file.
+ * @since 5.2
*/
TextRange newRange(int startLine, int startLineOffset, int endLine, int endLineOffset);
/**
- * Return a {@link TextRange} in the given file that select the full line.
+ * Returns a {@link TextRange} in the given file that select the full line.
* @param line Start at 1.
* @throw {@link IllegalArgumentException} if line is not valid for the given file.
+ * @since 5.2
*/
TextRange selectLine(int line);
}
package org.sonar.api.batch.fs;
/**
- * Represents a text range in an {@link InputFile}
+ * Represents a text range in an {@link InputFile}.
+ *
+ * A range is delimited by two {@link TextPointer}.
+ * <ul>
+ * <li><code>TextRange(TextPointer(1, 0), TextPointer(1, 1))</code> represents the first character at line 1</li>
+ * <li><code>TextRange(TextPointer(1, 0), TextPointer(1, 10))</code> represents the 10 first characters at line 1</li>
+ * </ul>
+ * @see InputFile#newRange(int, int, int, int)
*
* @since 5.2
*/
NewIssue overrideSeverity(@Nullable Severity severity);
/**
+ * Primary location for this issue.
* @since 5.2
- * Primary for this issue.
*/
NewIssue at(NewIssueLocation primaryLocation);
/**
- * @since 5.2
* Register an additional location for this issue.
- */
- NewIssue addLocation(NewIssueLocation location);
-
- /**
* @since 5.2
- * Register an execution flow for this issue.
*/
- NewIssue addExecutionFlow(NewIssueLocation... locations);
+ 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
- * Register an execution flow for this issue.
*/
- NewIssue addExecutionFlow(Iterable<NewIssueLocation> locations);
+ NewIssue addExecutionFlow(Iterable<NewIssueLocation> flowLocations);
/**
- * @since 5.2
* Create a new location for this issue. First registered location is considered as primary location.
+ * @since 5.2
*/
NewIssueLocation newLocation();
/**
- * @since 5.2
* Attach a new attribute to the issue. Not used by SQ but can be reused later for integration needs (for example it is returned by WS).
+ * @since 5.2
*/
NewIssue addAttribute(String key, String value);
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
return this;
}
- @Override
- public DefaultIssue addExecutionFlow(NewIssueLocation... locations) {
- return addExecutionFlow(Arrays.asList(locations));
- }
-
@Override
public DefaultIssue addExecutionFlow(Iterable<NewIssueLocation> locations) {
List<IssueLocation> flowAsList = new ArrayList<>();
/**
* @since 5.2
- * Register an execution flow for this issue.
+ * 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(NewIssueLocation... flow);
+ IssueBuilder addExecutionFlow(Iterable<NewIssueLocation> flowLocations);
/**
* Overrides the severity declared in Quality profile. Do not execute in standard use-cases.