From 2cefd460a1366f37c720c01964e00bac4b577c03 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 3 Sep 2015 18:17:36 +0200 Subject: [PATCH] SONAR-6052 Drop secondary locations and rename execution flow -> flow --- .../sonar/xoo/rule/MultilineIssuesSensor.java | 42 +- .../batch/protocol/output/BatchReport.java | 1160 +++++++---------- .../src/main/protobuf/batch_report.proto | 10 +- .../issue/DeprecatedIssueBuilderWrapper.java | 10 +- .../batch/issue/DeprecatedIssueWrapper.java | 4 +- .../org/sonar/batch/issue/ModuleIssues.java | 52 +- .../issues/MultilineIssuesMediumTest.java | 57 +- .../xources/hello/Multiline.xoo | 4 +- .../xources/hello/Multiple.xoo | 4 +- .../sample-multiline/xources/hello/Single.xoo | 2 +- .../xources/hello/WithFlow.xoo | 2 +- .../sonar/core/issue/DefaultIssueBuilder.java | 7 +- .../sonar/api/batch/sensor/issue/Issue.java | 12 +- .../api/batch/sensor/issue/NewIssue.java | 12 +- .../sensor/issue/internal/DefaultIssue.java | 28 +- .../java/org/sonar/api/issue/Issuable.java | 12 +- 16 files changed, 545 insertions(+), 873 deletions(-) diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java index 0bb2bf643b2..dec367142af 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java @@ -46,8 +46,8 @@ import org.sonar.xoo.Xoo; public class MultilineIssuesSensor implements Sensor { public static final String RULE_KEY = "MultilineIssue"; - private static final Pattern START_ISSUE_PATTERN = Pattern.compile("\\{xoo-start-issue:([0-9]+):([0-9]+)\\}"); - private static final Pattern END_ISSUE_PATTERN = Pattern.compile("\\{xoo-end-issue:([0-9]+):([0-9]+)\\}"); + private static final Pattern START_ISSUE_PATTERN = Pattern.compile("\\{xoo-start-issue:([0-9]+)\\}"); + private static final Pattern END_ISSUE_PATTERN = Pattern.compile("\\{xoo-end-issue:([0-9]+)\\}"); private static final Pattern START_FLOW_PATTERN = Pattern.compile("\\{xoo-start-flow:([0-9]+):([0-9]+):([0-9]+)\\}"); private static final Pattern END_FLOW_PATTERN = Pattern.compile("\\{xoo-end-flow:([0-9]+):([0-9]+):([0-9]+)\\}"); @@ -70,8 +70,8 @@ public class MultilineIssuesSensor implements Sensor { } private static void createIssues(InputFile file, SensorContext context) { - Table startIssuesPositions = HashBasedTable.create(); - Table endIssuesPositions = HashBasedTable.create(); + Map startIssuesPositions = Maps.newHashMap(); + Map endIssuesPositions = Maps.newHashMap(); Map> startFlowsPositions = Maps.newHashMap(); Map> endFlowsPositions = Maps.newHashMap(); @@ -116,24 +116,18 @@ public class MultilineIssuesSensor implements Sensor { } } - private static void createIssues(InputFile file, SensorContext context, Table startPositions, - Table endPositions, Map> startFlowsPositions, + private static void createIssues(InputFile file, SensorContext context, Map startPositions, + Map endPositions, Map> startFlowsPositions, Map> endFlowsPositions) { RuleKey ruleKey = RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY); - for (Map.Entry> entry : startPositions.rowMap().entrySet()) { - Integer issueId = entry.getKey(); + for (Map.Entry entry : startPositions.entrySet()) { NewIssue newIssue = context.newIssue().forRule(ruleKey); - for (Map.Entry location : entry.getValue().entrySet()) { - NewIssueLocation newLocation = newIssue.newLocation() - .on(file) - .at(file.newRange(location.getValue(), endPositions.row(entry.getKey()).get(location.getKey()))); - if (location.getKey() == 1) { - newIssue.at(newLocation.message("Primary location")); - } else { - newIssue.addLocation(newLocation.message("Location #" + location.getKey())); - } - } + Integer issueId = entry.getKey(); + NewIssueLocation primaryLocation = newIssue.newLocation() + .on(file) + .at(file.newRange(entry.getValue(), endPositions.get(issueId))); + newIssue.at(primaryLocation.message("Primary location")); if (startFlowsPositions.containsKey(issueId)) { Table flows = startFlowsPositions.get(issueId); for (Map.Entry> flowEntry : flows.rowMap().entrySet()) { @@ -150,15 +144,15 @@ public class MultilineIssuesSensor implements Sensor { .message("Flow step #" + flowNum); flowLocations.add(newLocation); } - newIssue.addExecutionFlow(flowLocations); + newIssue.addFlow(flowLocations); } } newIssue.save(); } } - private static void parseIssues(InputFile file, SensorContext context, Table startPositions, - Table endPositions) { + private static void parseIssues(InputFile file, SensorContext context, Map startPositions, + Map endPositions) { int currentLine = 0; try { for (String lineStr : Files.readAllLines(file.path(), context.fileSystem().encoding())) { @@ -167,17 +161,15 @@ public class MultilineIssuesSensor implements Sensor { Matcher m = START_ISSUE_PATTERN.matcher(lineStr); while (m.find()) { Integer issueId = Integer.parseInt(m.group(1)); - Integer issueLocationId = Integer.parseInt(m.group(2)); TextPointer newPointer = file.newPointer(currentLine, m.end()); - startPositions.row(issueId).put(issueLocationId, newPointer); + startPositions.put(issueId, newPointer); } m = END_ISSUE_PATTERN.matcher(lineStr); while (m.find()) { Integer issueId = Integer.parseInt(m.group(1)); - Integer issueLocationId = Integer.parseInt(m.group(2)); TextPointer newPointer = file.newPointer(currentLine, m.start()); - endPositions.row(issueId).put(issueLocationId, newPointer); + endPositions.put(issueId, newPointer); } } } catch (IOException e) { diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java index 753dea410c2..bbb3ac4d3e7 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java @@ -6522,10 +6522,20 @@ public final class BatchReport { /** * optional int32 line = 3; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     *TODO To be removed. Use first line of text_range instead
+     * 
*/ boolean hasLine(); /** * optional int32 line = 3; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     *TODO To be removed. Use first line of text_range instead
+     * 
*/ int getLine(); @@ -6576,64 +6586,52 @@ public final class BatchReport { getAttributesBytes(); /** - * optional .IssueLocation primary_location = 9; - */ - boolean hasPrimaryLocation(); - /** - * optional .IssueLocation primary_location = 9; - */ - org.sonar.batch.protocol.output.BatchReport.IssueLocation getPrimaryLocation(); - /** - * optional .IssueLocation primary_location = 9; - */ - org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder getPrimaryLocationOrBuilder(); - - /** - * repeated .IssueLocation additional_location = 10; - */ - java.util.List - getAdditionalLocationList(); - /** - * repeated .IssueLocation additional_location = 10; - */ - org.sonar.batch.protocol.output.BatchReport.IssueLocation getAdditionalLocation(int index); - /** - * repeated .IssueLocation additional_location = 10; + * optional .TextRange text_range = 9; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     * 
*/ - int getAdditionalLocationCount(); + boolean hasTextRange(); /** - * repeated .IssueLocation additional_location = 10; + * optional .TextRange text_range = 9; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     * 
*/ - java.util.List - getAdditionalLocationOrBuilderList(); + org.sonar.batch.protocol.output.BatchReport.TextRange getTextRange(); /** - * repeated .IssueLocation additional_location = 10; + * optional .TextRange text_range = 9; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     * 
*/ - org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder getAdditionalLocationOrBuilder( - int index); + org.sonar.batch.protocol.output.BatchReport.TextRangeOrBuilder getTextRangeOrBuilder(); /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - java.util.List - getExecutionFlowList(); + java.util.List + getFlowList(); /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow getExecutionFlow(int index); + org.sonar.batch.protocol.output.BatchReport.Flow getFlow(int index); /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - int getExecutionFlowCount(); + int getFlowCount(); /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - java.util.List - getExecutionFlowOrBuilderList(); + java.util.List + getFlowOrBuilderList(); /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder getExecutionFlowOrBuilder( + org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder getFlowOrBuilder( int index); } /** @@ -6734,32 +6732,24 @@ public final class BatchReport { break; } case 74: { - org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder subBuilder = null; + org.sonar.batch.protocol.output.BatchReport.TextRange.Builder subBuilder = null; if (((bitField0_ & 0x00000080) == 0x00000080)) { - subBuilder = primaryLocation_.toBuilder(); + subBuilder = textRange_.toBuilder(); } - primaryLocation_ = input.readMessage(org.sonar.batch.protocol.output.BatchReport.IssueLocation.PARSER, extensionRegistry); + textRange_ = input.readMessage(org.sonar.batch.protocol.output.BatchReport.TextRange.PARSER, extensionRegistry); if (subBuilder != null) { - subBuilder.mergeFrom(primaryLocation_); - primaryLocation_ = subBuilder.buildPartial(); + subBuilder.mergeFrom(textRange_); + textRange_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000080; break; } case 82: { if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - additionalLocation_ = new java.util.ArrayList(); + flow_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000100; } - additionalLocation_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.IssueLocation.PARSER, extensionRegistry)); - break; - } - case 90: { - if (!((mutable_bitField0_ & 0x00000200) == 0x00000200)) { - executionFlow_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000200; - } - executionFlow_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.PARSER, extensionRegistry)); + flow_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.Flow.PARSER, extensionRegistry)); break; } } @@ -6771,10 +6761,7 @@ public final class BatchReport { e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - additionalLocation_ = java.util.Collections.unmodifiableList(additionalLocation_); - } - if (((mutable_bitField0_ & 0x00000200) == 0x00000200)) { - executionFlow_ = java.util.Collections.unmodifiableList(executionFlow_); + flow_ = java.util.Collections.unmodifiableList(flow_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); @@ -6896,12 +6883,22 @@ public final class BatchReport { private int line_; /** * optional int32 line = 3; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     *TODO To be removed. Use first line of text_range instead
+     * 
*/ public boolean hasLine() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 line = 3; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     *TODO To be removed. Use first line of text_range instead
+     * 
*/ public int getLine() { return line_; @@ -7021,95 +7018,72 @@ public final class BatchReport { } } - public static final int PRIMARY_LOCATION_FIELD_NUMBER = 9; - private org.sonar.batch.protocol.output.BatchReport.IssueLocation primaryLocation_; + public static final int TEXT_RANGE_FIELD_NUMBER = 9; + private org.sonar.batch.protocol.output.BatchReport.TextRange textRange_; /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     * 
*/ - public boolean hasPrimaryLocation() { + public boolean hasTextRange() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** - * optional .IssueLocation primary_location = 9; - */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation getPrimaryLocation() { - return primaryLocation_; - } - /** - * optional .IssueLocation primary_location = 9; - */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder getPrimaryLocationOrBuilder() { - return primaryLocation_; - } - - public static final int ADDITIONAL_LOCATION_FIELD_NUMBER = 10; - private java.util.List additionalLocation_; - /** - * repeated .IssueLocation additional_location = 10; - */ - public java.util.List getAdditionalLocationList() { - return additionalLocation_; - } - /** - * repeated .IssueLocation additional_location = 10; - */ - public java.util.List - getAdditionalLocationOrBuilderList() { - return additionalLocation_; - } - /** - * repeated .IssueLocation additional_location = 10; - */ - public int getAdditionalLocationCount() { - return additionalLocation_.size(); - } - /** - * repeated .IssueLocation additional_location = 10; + * optional .TextRange text_range = 9; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     * 
*/ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation getAdditionalLocation(int index) { - return additionalLocation_.get(index); + public org.sonar.batch.protocol.output.BatchReport.TextRange getTextRange() { + return textRange_; } /** - * repeated .IssueLocation additional_location = 10; + * optional .TextRange text_range = 9; + * + *
+     * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+     * 
*/ - public org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder getAdditionalLocationOrBuilder( - int index) { - return additionalLocation_.get(index); + public org.sonar.batch.protocol.output.BatchReport.TextRangeOrBuilder getTextRangeOrBuilder() { + return textRange_; } - public static final int EXECUTION_FLOW_FIELD_NUMBER = 11; - private java.util.List executionFlow_; + public static final int FLOW_FIELD_NUMBER = 10; + private java.util.List flow_; /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - public java.util.List getExecutionFlowList() { - return executionFlow_; + public java.util.List getFlowList() { + return flow_; } /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - public java.util.List - getExecutionFlowOrBuilderList() { - return executionFlow_; + public java.util.List + getFlowOrBuilderList() { + return flow_; } /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - public int getExecutionFlowCount() { - return executionFlow_.size(); + public int getFlowCount() { + return flow_.size(); } /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow getExecutionFlow(int index) { - return executionFlow_.get(index); + public org.sonar.batch.protocol.output.BatchReport.Flow getFlow(int index) { + return flow_.get(index); } /** - * repeated .ExecutionFlow execution_flow = 11; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder getExecutionFlowOrBuilder( + public org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder getFlowOrBuilder( int index) { - return executionFlow_.get(index); + return flow_.get(index); } private void initFields() { @@ -7120,9 +7094,8 @@ public final class BatchReport { severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; effortToFix_ = 0D; attributes_ = ""; - primaryLocation_ = org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance(); - additionalLocation_ = java.util.Collections.emptyList(); - executionFlow_ = java.util.Collections.emptyList(); + textRange_ = org.sonar.batch.protocol.output.BatchReport.TextRange.getDefaultInstance(); + flow_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -7159,13 +7132,10 @@ public final class BatchReport { output.writeBytes(7, getAttributesBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { - output.writeMessage(9, primaryLocation_); - } - for (int i = 0; i < additionalLocation_.size(); i++) { - output.writeMessage(10, additionalLocation_.get(i)); + output.writeMessage(9, textRange_); } - for (int i = 0; i < executionFlow_.size(); i++) { - output.writeMessage(11, executionFlow_.get(i)); + for (int i = 0; i < flow_.size(); i++) { + output.writeMessage(10, flow_.get(i)); } getUnknownFields().writeTo(output); } @@ -7206,15 +7176,11 @@ public final class BatchReport { } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(9, primaryLocation_); + .computeMessageSize(9, textRange_); } - for (int i = 0; i < additionalLocation_.size(); i++) { + for (int i = 0; i < flow_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(10, additionalLocation_.get(i)); - } - for (int i = 0; i < executionFlow_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(11, executionFlow_.get(i)); + .computeMessageSize(10, flow_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -7325,9 +7291,8 @@ public final class BatchReport { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPrimaryLocationFieldBuilder(); - getAdditionalLocationFieldBuilder(); - getExecutionFlowFieldBuilder(); + getTextRangeFieldBuilder(); + getFlowFieldBuilder(); } } private static Builder create() { @@ -7350,23 +7315,17 @@ public final class BatchReport { bitField0_ = (bitField0_ & ~0x00000020); attributes_ = ""; bitField0_ = (bitField0_ & ~0x00000040); - if (primaryLocationBuilder_ == null) { - primaryLocation_ = org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance(); + if (textRangeBuilder_ == null) { + textRange_ = org.sonar.batch.protocol.output.BatchReport.TextRange.getDefaultInstance(); } else { - primaryLocationBuilder_.clear(); + textRangeBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000080); - if (additionalLocationBuilder_ == null) { - additionalLocation_ = java.util.Collections.emptyList(); + if (flowBuilder_ == null) { + flow_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); } else { - additionalLocationBuilder_.clear(); - } - if (executionFlowBuilder_ == null) { - executionFlow_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000200); - } else { - executionFlowBuilder_.clear(); + flowBuilder_.clear(); } return this; } @@ -7427,28 +7386,19 @@ public final class BatchReport { if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } - if (primaryLocationBuilder_ == null) { - result.primaryLocation_ = primaryLocation_; + if (textRangeBuilder_ == null) { + result.textRange_ = textRange_; } else { - result.primaryLocation_ = primaryLocationBuilder_.build(); + result.textRange_ = textRangeBuilder_.build(); } - if (additionalLocationBuilder_ == null) { + if (flowBuilder_ == null) { if (((bitField0_ & 0x00000100) == 0x00000100)) { - additionalLocation_ = java.util.Collections.unmodifiableList(additionalLocation_); + flow_ = java.util.Collections.unmodifiableList(flow_); bitField0_ = (bitField0_ & ~0x00000100); } - result.additionalLocation_ = additionalLocation_; + result.flow_ = flow_; } else { - result.additionalLocation_ = additionalLocationBuilder_.build(); - } - if (executionFlowBuilder_ == null) { - if (((bitField0_ & 0x00000200) == 0x00000200)) { - executionFlow_ = java.util.Collections.unmodifiableList(executionFlow_); - bitField0_ = (bitField0_ & ~0x00000200); - } - result.executionFlow_ = executionFlow_; - } else { - result.executionFlow_ = executionFlowBuilder_.build(); + result.flow_ = flowBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); @@ -7495,58 +7445,32 @@ public final class BatchReport { attributes_ = other.attributes_; onChanged(); } - if (other.hasPrimaryLocation()) { - mergePrimaryLocation(other.getPrimaryLocation()); + if (other.hasTextRange()) { + mergeTextRange(other.getTextRange()); } - if (additionalLocationBuilder_ == null) { - if (!other.additionalLocation_.isEmpty()) { - if (additionalLocation_.isEmpty()) { - additionalLocation_ = other.additionalLocation_; + if (flowBuilder_ == null) { + if (!other.flow_.isEmpty()) { + if (flow_.isEmpty()) { + flow_ = other.flow_; bitField0_ = (bitField0_ & ~0x00000100); } else { - ensureAdditionalLocationIsMutable(); - additionalLocation_.addAll(other.additionalLocation_); + ensureFlowIsMutable(); + flow_.addAll(other.flow_); } onChanged(); } } else { - if (!other.additionalLocation_.isEmpty()) { - if (additionalLocationBuilder_.isEmpty()) { - additionalLocationBuilder_.dispose(); - additionalLocationBuilder_ = null; - additionalLocation_ = other.additionalLocation_; + if (!other.flow_.isEmpty()) { + if (flowBuilder_.isEmpty()) { + flowBuilder_.dispose(); + flowBuilder_ = null; + flow_ = other.flow_; bitField0_ = (bitField0_ & ~0x00000100); - additionalLocationBuilder_ = + flowBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAdditionalLocationFieldBuilder() : null; + getFlowFieldBuilder() : null; } else { - additionalLocationBuilder_.addAllMessages(other.additionalLocation_); - } - } - } - if (executionFlowBuilder_ == null) { - if (!other.executionFlow_.isEmpty()) { - if (executionFlow_.isEmpty()) { - executionFlow_ = other.executionFlow_; - bitField0_ = (bitField0_ & ~0x00000200); - } else { - ensureExecutionFlowIsMutable(); - executionFlow_.addAll(other.executionFlow_); - } - onChanged(); - } - } else { - if (!other.executionFlow_.isEmpty()) { - if (executionFlowBuilder_.isEmpty()) { - executionFlowBuilder_.dispose(); - executionFlowBuilder_ = null; - executionFlow_ = other.executionFlow_; - bitField0_ = (bitField0_ & ~0x00000200); - executionFlowBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getExecutionFlowFieldBuilder() : null; - } else { - executionFlowBuilder_.addAllMessages(other.executionFlow_); + flowBuilder_.addAllMessages(other.flow_); } } } @@ -7732,18 +7656,33 @@ public final class BatchReport { private int line_ ; /** * optional int32 line = 3; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       *TODO To be removed. Use first line of text_range instead
+       * 
*/ public boolean hasLine() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 line = 3; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       *TODO To be removed. Use first line of text_range instead
+       * 
*/ public int getLine() { return line_; } /** * optional int32 line = 3; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       *TODO To be removed. Use first line of text_range instead
+       * 
*/ public Builder setLine(int value) { bitField0_ |= 0x00000004; @@ -7753,6 +7692,11 @@ public final class BatchReport { } /** * optional int32 line = 3; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       *TODO To be removed. Use first line of text_range instead
+       * 
*/ public Builder clearLine() { bitField0_ = (bitField0_ & ~0x00000004); @@ -7980,600 +7924,396 @@ public final class BatchReport { return this; } - private org.sonar.batch.protocol.output.BatchReport.IssueLocation primaryLocation_ = org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance(); + private org.sonar.batch.protocol.output.BatchReport.TextRange textRange_ = org.sonar.batch.protocol.output.BatchReport.TextRange.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.IssueLocation, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder, org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder> primaryLocationBuilder_; + org.sonar.batch.protocol.output.BatchReport.TextRange, org.sonar.batch.protocol.output.BatchReport.TextRange.Builder, org.sonar.batch.protocol.output.BatchReport.TextRangeOrBuilder> textRangeBuilder_; /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public boolean hasPrimaryLocation() { + public boolean hasTextRange() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation getPrimaryLocation() { - if (primaryLocationBuilder_ == null) { - return primaryLocation_; + public org.sonar.batch.protocol.output.BatchReport.TextRange getTextRange() { + if (textRangeBuilder_ == null) { + return textRange_; } else { - return primaryLocationBuilder_.getMessage(); + return textRangeBuilder_.getMessage(); } } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public Builder setPrimaryLocation(org.sonar.batch.protocol.output.BatchReport.IssueLocation value) { - if (primaryLocationBuilder_ == null) { + public Builder setTextRange(org.sonar.batch.protocol.output.BatchReport.TextRange value) { + if (textRangeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - primaryLocation_ = value; + textRange_ = value; onChanged(); } else { - primaryLocationBuilder_.setMessage(value); + textRangeBuilder_.setMessage(value); } bitField0_ |= 0x00000080; return this; } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public Builder setPrimaryLocation( - org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder builderForValue) { - if (primaryLocationBuilder_ == null) { - primaryLocation_ = builderForValue.build(); + public Builder setTextRange( + org.sonar.batch.protocol.output.BatchReport.TextRange.Builder builderForValue) { + if (textRangeBuilder_ == null) { + textRange_ = builderForValue.build(); onChanged(); } else { - primaryLocationBuilder_.setMessage(builderForValue.build()); + textRangeBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000080; return this; } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public Builder mergePrimaryLocation(org.sonar.batch.protocol.output.BatchReport.IssueLocation value) { - if (primaryLocationBuilder_ == null) { + public Builder mergeTextRange(org.sonar.batch.protocol.output.BatchReport.TextRange value) { + if (textRangeBuilder_ == null) { if (((bitField0_ & 0x00000080) == 0x00000080) && - primaryLocation_ != org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance()) { - primaryLocation_ = - org.sonar.batch.protocol.output.BatchReport.IssueLocation.newBuilder(primaryLocation_).mergeFrom(value).buildPartial(); + textRange_ != org.sonar.batch.protocol.output.BatchReport.TextRange.getDefaultInstance()) { + textRange_ = + org.sonar.batch.protocol.output.BatchReport.TextRange.newBuilder(textRange_).mergeFrom(value).buildPartial(); } else { - primaryLocation_ = value; + textRange_ = value; } onChanged(); } else { - primaryLocationBuilder_.mergeFrom(value); + textRangeBuilder_.mergeFrom(value); } bitField0_ |= 0x00000080; return this; } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public Builder clearPrimaryLocation() { - if (primaryLocationBuilder_ == null) { - primaryLocation_ = org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance(); + public Builder clearTextRange() { + if (textRangeBuilder_ == null) { + textRange_ = org.sonar.batch.protocol.output.BatchReport.TextRange.getDefaultInstance(); onChanged(); } else { - primaryLocationBuilder_.clear(); + textRangeBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000080); return this; } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder getPrimaryLocationBuilder() { + public org.sonar.batch.protocol.output.BatchReport.TextRange.Builder getTextRangeBuilder() { bitField0_ |= 0x00000080; onChanged(); - return getPrimaryLocationFieldBuilder().getBuilder(); + return getTextRangeFieldBuilder().getBuilder(); } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ - public org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder getPrimaryLocationOrBuilder() { - if (primaryLocationBuilder_ != null) { - return primaryLocationBuilder_.getMessageOrBuilder(); + public org.sonar.batch.protocol.output.BatchReport.TextRangeOrBuilder getTextRangeOrBuilder() { + if (textRangeBuilder_ != null) { + return textRangeBuilder_.getMessageOrBuilder(); } else { - return primaryLocation_; + return textRange_; } } /** - * optional .IssueLocation primary_location = 9; + * optional .TextRange text_range = 9; + * + *
+       * Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
+       * 
*/ private com.google.protobuf.SingleFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.IssueLocation, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder, org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder> - getPrimaryLocationFieldBuilder() { - if (primaryLocationBuilder_ == null) { - primaryLocationBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.IssueLocation, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder, org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder>( - getPrimaryLocation(), + org.sonar.batch.protocol.output.BatchReport.TextRange, org.sonar.batch.protocol.output.BatchReport.TextRange.Builder, org.sonar.batch.protocol.output.BatchReport.TextRangeOrBuilder> + getTextRangeFieldBuilder() { + if (textRangeBuilder_ == null) { + textRangeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.sonar.batch.protocol.output.BatchReport.TextRange, org.sonar.batch.protocol.output.BatchReport.TextRange.Builder, org.sonar.batch.protocol.output.BatchReport.TextRangeOrBuilder>( + getTextRange(), getParentForChildren(), isClean()); - primaryLocation_ = null; + textRange_ = null; } - return primaryLocationBuilder_; + return textRangeBuilder_; } - private java.util.List additionalLocation_ = + private java.util.List flow_ = java.util.Collections.emptyList(); - private void ensureAdditionalLocationIsMutable() { + private void ensureFlowIsMutable() { if (!((bitField0_ & 0x00000100) == 0x00000100)) { - additionalLocation_ = new java.util.ArrayList(additionalLocation_); + flow_ = new java.util.ArrayList(flow_); bitField0_ |= 0x00000100; } } private com.google.protobuf.RepeatedFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.IssueLocation, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder, org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder> additionalLocationBuilder_; + org.sonar.batch.protocol.output.BatchReport.Flow, org.sonar.batch.protocol.output.BatchReport.Flow.Builder, org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder> flowBuilder_; /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public java.util.List getAdditionalLocationList() { - if (additionalLocationBuilder_ == null) { - return java.util.Collections.unmodifiableList(additionalLocation_); + public java.util.List getFlowList() { + if (flowBuilder_ == null) { + return java.util.Collections.unmodifiableList(flow_); } else { - return additionalLocationBuilder_.getMessageList(); + return flowBuilder_.getMessageList(); } } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public int getAdditionalLocationCount() { - if (additionalLocationBuilder_ == null) { - return additionalLocation_.size(); + public int getFlowCount() { + if (flowBuilder_ == null) { + return flow_.size(); } else { - return additionalLocationBuilder_.getCount(); + return flowBuilder_.getCount(); } } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation getAdditionalLocation(int index) { - if (additionalLocationBuilder_ == null) { - return additionalLocation_.get(index); + public org.sonar.batch.protocol.output.BatchReport.Flow getFlow(int index) { + if (flowBuilder_ == null) { + return flow_.get(index); } else { - return additionalLocationBuilder_.getMessage(index); + return flowBuilder_.getMessage(index); } } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder setAdditionalLocation( - int index, org.sonar.batch.protocol.output.BatchReport.IssueLocation value) { - if (additionalLocationBuilder_ == null) { + public Builder setFlow( + int index, org.sonar.batch.protocol.output.BatchReport.Flow value) { + if (flowBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - ensureAdditionalLocationIsMutable(); - additionalLocation_.set(index, value); + ensureFlowIsMutable(); + flow_.set(index, value); onChanged(); } else { - additionalLocationBuilder_.setMessage(index, value); + flowBuilder_.setMessage(index, value); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder setAdditionalLocation( - int index, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder builderForValue) { - if (additionalLocationBuilder_ == null) { - ensureAdditionalLocationIsMutable(); - additionalLocation_.set(index, builderForValue.build()); + public Builder setFlow( + int index, org.sonar.batch.protocol.output.BatchReport.Flow.Builder builderForValue) { + if (flowBuilder_ == null) { + ensureFlowIsMutable(); + flow_.set(index, builderForValue.build()); onChanged(); } else { - additionalLocationBuilder_.setMessage(index, builderForValue.build()); + flowBuilder_.setMessage(index, builderForValue.build()); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder addAdditionalLocation(org.sonar.batch.protocol.output.BatchReport.IssueLocation value) { - if (additionalLocationBuilder_ == null) { + public Builder addFlow(org.sonar.batch.protocol.output.BatchReport.Flow value) { + if (flowBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - ensureAdditionalLocationIsMutable(); - additionalLocation_.add(value); + ensureFlowIsMutable(); + flow_.add(value); onChanged(); } else { - additionalLocationBuilder_.addMessage(value); + flowBuilder_.addMessage(value); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder addAdditionalLocation( - int index, org.sonar.batch.protocol.output.BatchReport.IssueLocation value) { - if (additionalLocationBuilder_ == null) { + public Builder addFlow( + int index, org.sonar.batch.protocol.output.BatchReport.Flow value) { + if (flowBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - ensureAdditionalLocationIsMutable(); - additionalLocation_.add(index, value); + ensureFlowIsMutable(); + flow_.add(index, value); onChanged(); } else { - additionalLocationBuilder_.addMessage(index, value); + flowBuilder_.addMessage(index, value); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder addAdditionalLocation( - org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder builderForValue) { - if (additionalLocationBuilder_ == null) { - ensureAdditionalLocationIsMutable(); - additionalLocation_.add(builderForValue.build()); + public Builder addFlow( + org.sonar.batch.protocol.output.BatchReport.Flow.Builder builderForValue) { + if (flowBuilder_ == null) { + ensureFlowIsMutable(); + flow_.add(builderForValue.build()); onChanged(); } else { - additionalLocationBuilder_.addMessage(builderForValue.build()); + flowBuilder_.addMessage(builderForValue.build()); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder addAdditionalLocation( - int index, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder builderForValue) { - if (additionalLocationBuilder_ == null) { - ensureAdditionalLocationIsMutable(); - additionalLocation_.add(index, builderForValue.build()); + public Builder addFlow( + int index, org.sonar.batch.protocol.output.BatchReport.Flow.Builder builderForValue) { + if (flowBuilder_ == null) { + ensureFlowIsMutable(); + flow_.add(index, builderForValue.build()); onChanged(); } else { - additionalLocationBuilder_.addMessage(index, builderForValue.build()); + flowBuilder_.addMessage(index, builderForValue.build()); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder addAllAdditionalLocation( - java.lang.Iterable values) { - if (additionalLocationBuilder_ == null) { - ensureAdditionalLocationIsMutable(); + public Builder addAllFlow( + java.lang.Iterable values) { + if (flowBuilder_ == null) { + ensureFlowIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, additionalLocation_); + values, flow_); onChanged(); } else { - additionalLocationBuilder_.addAllMessages(values); + flowBuilder_.addAllMessages(values); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder clearAdditionalLocation() { - if (additionalLocationBuilder_ == null) { - additionalLocation_ = java.util.Collections.emptyList(); + public Builder clearFlow() { + if (flowBuilder_ == null) { + flow_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); onChanged(); } else { - additionalLocationBuilder_.clear(); + flowBuilder_.clear(); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public Builder removeAdditionalLocation(int index) { - if (additionalLocationBuilder_ == null) { - ensureAdditionalLocationIsMutable(); - additionalLocation_.remove(index); + public Builder removeFlow(int index) { + if (flowBuilder_ == null) { + ensureFlowIsMutable(); + flow_.remove(index); onChanged(); } else { - additionalLocationBuilder_.remove(index); + flowBuilder_.remove(index); } return this; } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder getAdditionalLocationBuilder( + public org.sonar.batch.protocol.output.BatchReport.Flow.Builder getFlowBuilder( int index) { - return getAdditionalLocationFieldBuilder().getBuilder(index); + return getFlowFieldBuilder().getBuilder(index); } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder getAdditionalLocationOrBuilder( + public org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder getFlowOrBuilder( int index) { - if (additionalLocationBuilder_ == null) { - return additionalLocation_.get(index); } else { - return additionalLocationBuilder_.getMessageOrBuilder(index); + if (flowBuilder_ == null) { + return flow_.get(index); } else { + return flowBuilder_.getMessageOrBuilder(index); } } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public java.util.List - getAdditionalLocationOrBuilderList() { - if (additionalLocationBuilder_ != null) { - return additionalLocationBuilder_.getMessageOrBuilderList(); + public java.util.List + getFlowOrBuilderList() { + if (flowBuilder_ != null) { + return flowBuilder_.getMessageOrBuilderList(); } else { - return java.util.Collections.unmodifiableList(additionalLocation_); + return java.util.Collections.unmodifiableList(flow_); } } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder addAdditionalLocationBuilder() { - return getAdditionalLocationFieldBuilder().addBuilder( - org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance()); + public org.sonar.batch.protocol.output.BatchReport.Flow.Builder addFlowBuilder() { + return getFlowFieldBuilder().addBuilder( + org.sonar.batch.protocol.output.BatchReport.Flow.getDefaultInstance()); } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder addAdditionalLocationBuilder( + public org.sonar.batch.protocol.output.BatchReport.Flow.Builder addFlowBuilder( int index) { - return getAdditionalLocationFieldBuilder().addBuilder( - index, org.sonar.batch.protocol.output.BatchReport.IssueLocation.getDefaultInstance()); + return getFlowFieldBuilder().addBuilder( + index, org.sonar.batch.protocol.output.BatchReport.Flow.getDefaultInstance()); } /** - * repeated .IssueLocation additional_location = 10; + * repeated .Flow flow = 10; */ - public java.util.List - getAdditionalLocationBuilderList() { - return getAdditionalLocationFieldBuilder().getBuilderList(); + public java.util.List + getFlowBuilderList() { + return getFlowFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.IssueLocation, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder, org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder> - getAdditionalLocationFieldBuilder() { - if (additionalLocationBuilder_ == null) { - additionalLocationBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.IssueLocation, org.sonar.batch.protocol.output.BatchReport.IssueLocation.Builder, org.sonar.batch.protocol.output.BatchReport.IssueLocationOrBuilder>( - additionalLocation_, + org.sonar.batch.protocol.output.BatchReport.Flow, org.sonar.batch.protocol.output.BatchReport.Flow.Builder, org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder> + getFlowFieldBuilder() { + if (flowBuilder_ == null) { + flowBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.sonar.batch.protocol.output.BatchReport.Flow, org.sonar.batch.protocol.output.BatchReport.Flow.Builder, org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder>( + flow_, ((bitField0_ & 0x00000100) == 0x00000100), getParentForChildren(), isClean()); - additionalLocation_ = null; - } - return additionalLocationBuilder_; - } - - private java.util.List executionFlow_ = - java.util.Collections.emptyList(); - private void ensureExecutionFlowIsMutable() { - if (!((bitField0_ & 0x00000200) == 0x00000200)) { - executionFlow_ = new java.util.ArrayList(executionFlow_); - bitField0_ |= 0x00000200; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder, org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder> executionFlowBuilder_; - - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public java.util.List getExecutionFlowList() { - if (executionFlowBuilder_ == null) { - return java.util.Collections.unmodifiableList(executionFlow_); - } else { - return executionFlowBuilder_.getMessageList(); - } - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public int getExecutionFlowCount() { - if (executionFlowBuilder_ == null) { - return executionFlow_.size(); - } else { - return executionFlowBuilder_.getCount(); - } - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow getExecutionFlow(int index) { - if (executionFlowBuilder_ == null) { - return executionFlow_.get(index); - } else { - return executionFlowBuilder_.getMessage(index); - } - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder setExecutionFlow( - int index, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow value) { - if (executionFlowBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExecutionFlowIsMutable(); - executionFlow_.set(index, value); - onChanged(); - } else { - executionFlowBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder setExecutionFlow( - int index, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder builderForValue) { - if (executionFlowBuilder_ == null) { - ensureExecutionFlowIsMutable(); - executionFlow_.set(index, builderForValue.build()); - onChanged(); - } else { - executionFlowBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder addExecutionFlow(org.sonar.batch.protocol.output.BatchReport.ExecutionFlow value) { - if (executionFlowBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExecutionFlowIsMutable(); - executionFlow_.add(value); - onChanged(); - } else { - executionFlowBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder addExecutionFlow( - int index, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow value) { - if (executionFlowBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExecutionFlowIsMutable(); - executionFlow_.add(index, value); - onChanged(); - } else { - executionFlowBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder addExecutionFlow( - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder builderForValue) { - if (executionFlowBuilder_ == null) { - ensureExecutionFlowIsMutable(); - executionFlow_.add(builderForValue.build()); - onChanged(); - } else { - executionFlowBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder addExecutionFlow( - int index, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder builderForValue) { - if (executionFlowBuilder_ == null) { - ensureExecutionFlowIsMutable(); - executionFlow_.add(index, builderForValue.build()); - onChanged(); - } else { - executionFlowBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder addAllExecutionFlow( - java.lang.Iterable values) { - if (executionFlowBuilder_ == null) { - ensureExecutionFlowIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, executionFlow_); - onChanged(); - } else { - executionFlowBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder clearExecutionFlow() { - if (executionFlowBuilder_ == null) { - executionFlow_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000200); - onChanged(); - } else { - executionFlowBuilder_.clear(); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public Builder removeExecutionFlow(int index) { - if (executionFlowBuilder_ == null) { - ensureExecutionFlowIsMutable(); - executionFlow_.remove(index); - onChanged(); - } else { - executionFlowBuilder_.remove(index); - } - return this; - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder getExecutionFlowBuilder( - int index) { - return getExecutionFlowFieldBuilder().getBuilder(index); - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder getExecutionFlowOrBuilder( - int index) { - if (executionFlowBuilder_ == null) { - return executionFlow_.get(index); } else { - return executionFlowBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public java.util.List - getExecutionFlowOrBuilderList() { - if (executionFlowBuilder_ != null) { - return executionFlowBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(executionFlow_); - } - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder addExecutionFlowBuilder() { - return getExecutionFlowFieldBuilder().addBuilder( - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.getDefaultInstance()); - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder addExecutionFlowBuilder( - int index) { - return getExecutionFlowFieldBuilder().addBuilder( - index, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.getDefaultInstance()); - } - /** - * repeated .ExecutionFlow execution_flow = 11; - */ - public java.util.List - getExecutionFlowBuilderList() { - return getExecutionFlowFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder, org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder> - getExecutionFlowFieldBuilder() { - if (executionFlowBuilder_ == null) { - executionFlowBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder, org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder>( - executionFlow_, - ((bitField0_ & 0x00000200) == 0x00000200), - getParentForChildren(), - isClean()); - executionFlow_ = null; + flow_ = null; } - return executionFlowBuilder_; + return flowBuilder_; } // @@protoc_insertion_point(builder_scope:Issue) @@ -9390,8 +9130,8 @@ public final class BatchReport { // @@protoc_insertion_point(class_scope:IssueLocation) } - public interface ExecutionFlowOrBuilder extends - // @@protoc_insertion_point(interface_extends:ExecutionFlow) + public interface FlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:Flow) com.google.protobuf.MessageOrBuilder { /** @@ -9419,25 +9159,25 @@ public final class BatchReport { int index); } /** - * Protobuf type {@code ExecutionFlow} + * Protobuf type {@code Flow} */ - public static final class ExecutionFlow extends + public static final class Flow extends com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:ExecutionFlow) - ExecutionFlowOrBuilder { - // Use ExecutionFlow.newBuilder() to construct. - private ExecutionFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + // @@protoc_insertion_point(message_implements:Flow) + FlowOrBuilder { + // Use Flow.newBuilder() to construct. + private Flow(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } - private ExecutionFlow(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private Flow(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - private static final ExecutionFlow defaultInstance; - public static ExecutionFlow getDefaultInstance() { + private static final Flow defaultInstance; + public static Flow getDefaultInstance() { return defaultInstance; } - public ExecutionFlow getDefaultInstanceForType() { + public Flow getDefaultInstanceForType() { return defaultInstance; } @@ -9447,7 +9187,7 @@ public final class BatchReport { getUnknownFields() { return this.unknownFields; } - private ExecutionFlow( + private Flow( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -9495,28 +9235,28 @@ public final class BatchReport { } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.sonar.batch.protocol.output.BatchReport.internal_static_ExecutionFlow_descriptor; + return org.sonar.batch.protocol.output.BatchReport.internal_static_Flow_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.sonar.batch.protocol.output.BatchReport.internal_static_ExecutionFlow_fieldAccessorTable + return org.sonar.batch.protocol.output.BatchReport.internal_static_Flow_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.class, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder.class); + org.sonar.batch.protocol.output.BatchReport.Flow.class, org.sonar.batch.protocol.output.BatchReport.Flow.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public ExecutionFlow parsePartialFrom( + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Flow parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ExecutionFlow(input, extensionRegistry); + return new Flow(input, extensionRegistry); } }; @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } @@ -9599,53 +9339,53 @@ public final class BatchReport { return super.writeReplace(); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom(byte[] data) + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom(java.io.InputStream input) + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseDelimitedFrom(java.io.InputStream input) + public static org.sonar.batch.protocol.output.BatchReport.Flow parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseDelimitedFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parseFrom( + public static org.sonar.batch.protocol.output.BatchReport.Flow parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -9654,7 +9394,7 @@ public final class BatchReport { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.sonar.batch.protocol.output.BatchReport.ExecutionFlow prototype) { + public static Builder newBuilder(org.sonar.batch.protocol.output.BatchReport.Flow prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -9666,25 +9406,25 @@ public final class BatchReport { return builder; } /** - * Protobuf type {@code ExecutionFlow} + * Protobuf type {@code Flow} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:ExecutionFlow) - org.sonar.batch.protocol.output.BatchReport.ExecutionFlowOrBuilder { + // @@protoc_insertion_point(builder_implements:Flow) + org.sonar.batch.protocol.output.BatchReport.FlowOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.sonar.batch.protocol.output.BatchReport.internal_static_ExecutionFlow_descriptor; + return org.sonar.batch.protocol.output.BatchReport.internal_static_Flow_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.sonar.batch.protocol.output.BatchReport.internal_static_ExecutionFlow_fieldAccessorTable + return org.sonar.batch.protocol.output.BatchReport.internal_static_Flow_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.class, org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.Builder.class); + org.sonar.batch.protocol.output.BatchReport.Flow.class, org.sonar.batch.protocol.output.BatchReport.Flow.Builder.class); } - // Construct using org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.newBuilder() + // Construct using org.sonar.batch.protocol.output.BatchReport.Flow.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -9720,23 +9460,23 @@ public final class BatchReport { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.sonar.batch.protocol.output.BatchReport.internal_static_ExecutionFlow_descriptor; + return org.sonar.batch.protocol.output.BatchReport.internal_static_Flow_descriptor; } - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow getDefaultInstanceForType() { - return org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.getDefaultInstance(); + public org.sonar.batch.protocol.output.BatchReport.Flow getDefaultInstanceForType() { + return org.sonar.batch.protocol.output.BatchReport.Flow.getDefaultInstance(); } - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow build() { - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow result = buildPartial(); + public org.sonar.batch.protocol.output.BatchReport.Flow build() { + org.sonar.batch.protocol.output.BatchReport.Flow result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - public org.sonar.batch.protocol.output.BatchReport.ExecutionFlow buildPartial() { - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow result = new org.sonar.batch.protocol.output.BatchReport.ExecutionFlow(this); + public org.sonar.batch.protocol.output.BatchReport.Flow buildPartial() { + org.sonar.batch.protocol.output.BatchReport.Flow result = new org.sonar.batch.protocol.output.BatchReport.Flow(this); int from_bitField0_ = bitField0_; if (locationBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { @@ -9752,16 +9492,16 @@ public final class BatchReport { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.sonar.batch.protocol.output.BatchReport.ExecutionFlow) { - return mergeFrom((org.sonar.batch.protocol.output.BatchReport.ExecutionFlow)other); + if (other instanceof org.sonar.batch.protocol.output.BatchReport.Flow) { + return mergeFrom((org.sonar.batch.protocol.output.BatchReport.Flow)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.sonar.batch.protocol.output.BatchReport.ExecutionFlow other) { - if (other == org.sonar.batch.protocol.output.BatchReport.ExecutionFlow.getDefaultInstance()) return this; + public Builder mergeFrom(org.sonar.batch.protocol.output.BatchReport.Flow other) { + if (other == org.sonar.batch.protocol.output.BatchReport.Flow.getDefaultInstance()) return this; if (locationBuilder_ == null) { if (!other.location_.isEmpty()) { if (location_.isEmpty()) { @@ -9800,11 +9540,11 @@ public final class BatchReport { com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.sonar.batch.protocol.output.BatchReport.ExecutionFlow parsedMessage = null; + org.sonar.batch.protocol.output.BatchReport.Flow parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.sonar.batch.protocol.output.BatchReport.ExecutionFlow) e.getUnfinishedMessage(); + parsedMessage = (org.sonar.batch.protocol.output.BatchReport.Flow) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { @@ -10055,15 +9795,15 @@ public final class BatchReport { return locationBuilder_; } - // @@protoc_insertion_point(builder_scope:ExecutionFlow) + // @@protoc_insertion_point(builder_scope:Flow) } static { - defaultInstance = new ExecutionFlow(true); + defaultInstance = new Flow(true); defaultInstance.initFields(); } - // @@protoc_insertion_point(class_scope:ExecutionFlow) + // @@protoc_insertion_point(class_scope:Flow) } public interface ChangesetsOrBuilder extends @@ -19203,10 +18943,10 @@ public final class BatchReport { com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_IssueLocation_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor - internal_static_ExecutionFlow_descriptor; + internal_static_Flow_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_ExecutionFlow_fieldAccessorTable; + internal_static_Flow_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_Changesets_descriptor; private static @@ -19290,44 +19030,42 @@ public final class BatchReport { "_type\030\001 \001(\0162\021.MeasureValueType\022\025\n\rboolea" + "n_value\030\002 \001(\010\022\021\n\tint_value\030\003 \001(\005\022\022\n\nlong" + "_value\030\004 \001(\003\022\024\n\014double_value\030\005 \001(\001\022\024\n\014st" + - "ring_value\030\006 \001(\t\022\022\n\nmetric_key\030\007 \001(\t\"\224\002\n", + "ring_value\030\006 \001(\t\022\022\n\nmetric_key\030\007 \001(\t\"\312\001\n", "\005Issue\022\027\n\017rule_repository\030\001 \001(\t\022\020\n\010rule_" + "key\030\002 \001(\t\022\014\n\004line\030\003 \001(\005\022\013\n\003msg\030\004 \001(\t\022\033\n\010" + "severity\030\005 \001(\0162\t.Severity\022\025\n\reffort_to_f" + - "ix\030\006 \001(\001\022\022\n\nattributes\030\007 \001(\t\022(\n\020primary_" + - "location\030\t \001(\0132\016.IssueLocation\022+\n\023additi" + - "onal_location\030\n \003(\0132\016.IssueLocation\022&\n\016e" + - "xecution_flow\030\013 \003(\0132\016.ExecutionFlow\"S\n\rI" + - "ssueLocation\022\025\n\rcomponent_ref\030\001 \001(\005\022\036\n\nt" + - "ext_range\030\002 \001(\0132\n.TextRange\022\013\n\003msg\030\003 \001(\t" + - "\"1\n\rExecutionFlow\022 \n\010location\030\001 \003(\0132\016.Is", - "sueLocation\"\254\001\n\nChangesets\022\025\n\rcomponent_" + - "ref\030\001 \001(\005\022(\n\tchangeset\030\002 \003(\0132\025.Changeset" + - "s.Changeset\022 \n\024changesetIndexByLine\030\003 \003(" + - "\005B\002\020\001\032;\n\tChangeset\022\020\n\010revision\030\001 \001(\t\022\016\n\006" + - "author\030\002 \001(\t\022\014\n\004date\030\003 \001(\003\"V\n\tDuplicate\022" + - "\026\n\016other_file_ref\030\001 \001(\005\022\031\n\005range\030\002 \001(\0132\n" + - ".TextRange\022\026\n\016other_file_key\030\003 \001(\t\"Q\n\013Du" + - "plication\022#\n\017origin_position\030\001 \001(\0132\n.Tex" + - "tRange\022\035\n\tduplicate\030\002 \003(\0132\n.Duplicate\"[\n" + - "\tTextRange\022\022\n\nstart_line\030\001 \001(\005\022\020\n\010end_li", - "ne\030\002 \001(\005\022\024\n\014start_offset\030\003 \001(\005\022\022\n\nend_of" + - "fset\030\004 \001(\005\"H\n\006Symbol\022\037\n\013declaration\030\001 \001(" + - "\0132\n.TextRange\022\035\n\treference\030\002 \003(\0132\n.TextR" + - "ange\"\260\001\n\010Coverage\022\014\n\004line\030\001 \001(\005\022\022\n\ncondi" + - "tions\030\002 \001(\005\022\017\n\007ut_hits\030\003 \001(\010\022\017\n\007it_hits\030" + - "\004 \001(\010\022\035\n\025ut_covered_conditions\030\005 \001(\005\022\035\n\025" + - "it_covered_conditions\030\006 \001(\005\022\"\n\032overall_c" + - "overed_conditions\030\007 \001(\005\"P\n\022SyntaxHighlig" + - "hting\022\031\n\005range\030\001 \001(\0132\n.TextRange\022\037\n\004type" + - "\030\002 \001(\0162\021.HighlightingType\"j\n\004Test\022\014\n\004nam", - "e\030\001 \001(\t\022\033\n\006status\030\002 \001(\0162\013.TestStatus\022\026\n\016" + - "duration_in_ms\030\003 \001(\003\022\022\n\nstacktrace\030\004 \001(\t" + - "\022\013\n\003msg\030\005 \001(\t\"\221\001\n\016CoverageDetail\022\021\n\ttest" + - "_name\030\001 \001(\t\0221\n\014covered_file\030\002 \003(\0132\033.Cove" + - "rageDetail.CoveredFile\0329\n\013CoveredFile\022\020\n" + - "\010file_ref\030\001 \001(\005\022\030\n\014covered_line\030\002 \003(\005B\002\020" + - "\001B#\n\037org.sonar.batch.protocol.outputH\001" + "ix\030\006 \001(\001\022\022\n\nattributes\030\007 \001(\t\022\036\n\ntext_ran" + + "ge\030\t \001(\0132\n.TextRange\022\023\n\004flow\030\n \003(\0132\005.Flo" + + "w\"S\n\rIssueLocation\022\025\n\rcomponent_ref\030\001 \001(" + + "\005\022\036\n\ntext_range\030\002 \001(\0132\n.TextRange\022\013\n\003msg" + + "\030\003 \001(\t\"(\n\004Flow\022 \n\010location\030\001 \003(\0132\016.Issue" + + "Location\"\254\001\n\nChangesets\022\025\n\rcomponent_ref" + + "\030\001 \001(\005\022(\n\tchangeset\030\002 \003(\0132\025.Changesets.C", + "hangeset\022 \n\024changesetIndexByLine\030\003 \003(\005B\002" + + "\020\001\032;\n\tChangeset\022\020\n\010revision\030\001 \001(\t\022\016\n\006aut" + + "hor\030\002 \001(\t\022\014\n\004date\030\003 \001(\003\"V\n\tDuplicate\022\026\n\016" + + "other_file_ref\030\001 \001(\005\022\031\n\005range\030\002 \001(\0132\n.Te" + + "xtRange\022\026\n\016other_file_key\030\003 \001(\t\"Q\n\013Dupli" + + "cation\022#\n\017origin_position\030\001 \001(\0132\n.TextRa" + + "nge\022\035\n\tduplicate\030\002 \003(\0132\n.Duplicate\"[\n\tTe" + + "xtRange\022\022\n\nstart_line\030\001 \001(\005\022\020\n\010end_line\030" + + "\002 \001(\005\022\024\n\014start_offset\030\003 \001(\005\022\022\n\nend_offse" + + "t\030\004 \001(\005\"H\n\006Symbol\022\037\n\013declaration\030\001 \001(\0132\n", + ".TextRange\022\035\n\treference\030\002 \003(\0132\n.TextRang" + + "e\"\260\001\n\010Coverage\022\014\n\004line\030\001 \001(\005\022\022\n\nconditio" + + "ns\030\002 \001(\005\022\017\n\007ut_hits\030\003 \001(\010\022\017\n\007it_hits\030\004 \001" + + "(\010\022\035\n\025ut_covered_conditions\030\005 \001(\005\022\035\n\025it_" + + "covered_conditions\030\006 \001(\005\022\"\n\032overall_cove" + + "red_conditions\030\007 \001(\005\"P\n\022SyntaxHighlighti" + + "ng\022\031\n\005range\030\001 \001(\0132\n.TextRange\022\037\n\004type\030\002 " + + "\001(\0162\021.HighlightingType\"j\n\004Test\022\014\n\004name\030\001" + + " \001(\t\022\033\n\006status\030\002 \001(\0162\013.TestStatus\022\026\n\016dur" + + "ation_in_ms\030\003 \001(\003\022\022\n\nstacktrace\030\004 \001(\t\022\013\n", + "\003msg\030\005 \001(\t\"\221\001\n\016CoverageDetail\022\021\n\ttest_na" + + "me\030\001 \001(\t\0221\n\014covered_file\030\002 \003(\0132\033.Coverag" + + "eDetail.CoveredFile\0329\n\013CoveredFile\022\020\n\010fi" + + "le_ref\030\001 \001(\005\022\030\n\014covered_line\030\002 \003(\005B\002\020\001B#" + + "\n\037org.sonar.batch.protocol.outputH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -19383,18 +19121,18 @@ public final class BatchReport { internal_static_Issue_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Issue_descriptor, - new java.lang.String[] { "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "EffortToFix", "Attributes", "PrimaryLocation", "AdditionalLocation", "ExecutionFlow", }); + new java.lang.String[] { "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "EffortToFix", "Attributes", "TextRange", "Flow", }); internal_static_IssueLocation_descriptor = getDescriptor().getMessageTypes().get(6); internal_static_IssueLocation_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_IssueLocation_descriptor, new java.lang.String[] { "ComponentRef", "TextRange", "Msg", }); - internal_static_ExecutionFlow_descriptor = + internal_static_Flow_descriptor = getDescriptor().getMessageTypes().get(7); - internal_static_ExecutionFlow_fieldAccessorTable = new + internal_static_Flow_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_ExecutionFlow_descriptor, + internal_static_Flow_descriptor, new java.lang.String[] { "Location", }); internal_static_Changesets_descriptor = getDescriptor().getMessageTypes().get(8); diff --git a/sonar-batch-protocol/src/main/protobuf/batch_report.proto b/sonar-batch-protocol/src/main/protobuf/batch_report.proto index 21fe15c2955..efe36ee08f6 100644 --- a/sonar-batch-protocol/src/main/protobuf/batch_report.proto +++ b/sonar-batch-protocol/src/main/protobuf/batch_report.proto @@ -98,14 +98,16 @@ message Measure { message Issue { optional string rule_repository = 1; optional string rule_key = 2; + // Only when issue component is a file. Can also be empty for a file if this is an issue global to the file. + //TODO To be removed. Use first line of text_range instead optional int32 line = 3; optional string msg = 4; optional Severity severity = 5; optional double effort_to_fix = 6; optional string attributes = 7; - optional IssueLocation primary_location = 9; - repeated IssueLocation additional_location = 10; - repeated ExecutionFlow execution_flow = 11; + // Only when issue component is a file. Can also be empty for a file if this is an issue global to the file. + optional TextRange text_range = 9; + repeated Flow flow = 10; } message IssueLocation { @@ -115,7 +117,7 @@ message IssueLocation { optional string msg = 3; } -message ExecutionFlow { +message Flow { repeated IssueLocation location = 1; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueBuilderWrapper.java b/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueBuilderWrapper.java index e3f416a9ef9..7bfbf6d81d2 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueBuilderWrapper.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueBuilderWrapper.java @@ -84,14 +84,8 @@ public class DeprecatedIssueBuilderWrapper implements Issuable.IssueBuilder { } @Override - public IssueBuilder addLocation(NewIssueLocation location) { - newIssue.addLocation(location); - return this; - } - - @Override - public IssueBuilder addExecutionFlow(Iterable flowLocations) { - newIssue.addExecutionFlow(flowLocations); + public IssueBuilder addFlow(Iterable flowLocations) { + newIssue.addFlow(flowLocations); return this; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueWrapper.java b/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueWrapper.java index d1d2efdf8f1..83287731be0 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueWrapper.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/DeprecatedIssueWrapper.java @@ -72,12 +72,12 @@ public class DeprecatedIssueWrapper implements Issue { @Override public String message() { - return newIssue.locations().get(0).message(); + return newIssue.primaryLocation().message(); } @Override public Integer line() { - TextRange textRange = newIssue.locations().get(0).textRange(); + TextRange textRange = newIssue.primaryLocation().textRange(); return textRange != null ? textRange.start().line() : null; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java index 4363a59853b..9db7fd69fde 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ModuleIssues.java @@ -27,7 +27,7 @@ import org.sonar.api.batch.rule.ActiveRules; import org.sonar.api.batch.rule.Rule; import org.sonar.api.batch.rule.Rules; import org.sonar.api.batch.sensor.issue.Issue; -import org.sonar.api.batch.sensor.issue.Issue.ExecutionFlow; +import org.sonar.api.batch.sensor.issue.Issue.Flow; import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.KeyValueFormat; import org.sonar.api.utils.MessageException; @@ -52,7 +52,7 @@ public class ModuleIssues { private final BatchReport.Issue.Builder builder = BatchReport.Issue.newBuilder(); private final Builder locationBuilder = IssueLocation.newBuilder(); private final org.sonar.batch.protocol.output.BatchReport.TextRange.Builder textRangeBuilder = org.sonar.batch.protocol.output.BatchReport.TextRange.newBuilder(); - private final BatchReport.ExecutionFlow.Builder flowBuilder = BatchReport.ExecutionFlow.newBuilder(); + private final BatchReport.Flow.Builder flowBuilder = BatchReport.Flow.newBuilder(); public ModuleIssues(ActiveRules activeRules, Rules rules, IssueFilters filters, ReportPublisher reportPublisher, BatchComponentCache componentCache) { this.activeRules = activeRules; @@ -89,17 +89,15 @@ public class ModuleIssues { locationBuilder.setComponentRef(component.batchId()); TextRange primaryTextRange = issue.primaryLocation().textRange(); - applyTextRange(primaryTextRange); if (primaryTextRange != null) { builder.setLine(primaryTextRange.start().line()); + builder.setTextRange(toProtobufTextRange(primaryTextRange)); } - builder.setPrimaryLocation(locationBuilder.build()); Double effortToFix = issue.effortToFix(); if (effortToFix != null) { builder.setEffortToFix(effortToFix); } - applyAdditionalLocations(issue); - applyExecutionFlows(issue); + applyFlows(issue); BatchReport.Issue rawIssue = builder.build(); if (filters.accept(inputComponent.key(), rawIssue)) { @@ -109,45 +107,33 @@ public class ModuleIssues { return false; } - private void applyAdditionalLocations(Issue issue) { - for (org.sonar.api.batch.sensor.issue.IssueLocation additionalLocation : issue.locations()) { - locationBuilder.clear(); - locationBuilder.setComponentRef(componentCache.get(additionalLocation.inputComponent()).batchId()); - String message = additionalLocation.message(); - if (message != null) { - locationBuilder.setMsg(message); - } - applyTextRange(additionalLocation.textRange()); - builder.addAdditionalLocation(locationBuilder.build()); - } - } - - private void applyExecutionFlows(Issue issue) { - for (ExecutionFlow executionFlow : issue.executionFlows()) { + private void applyFlows(Issue issue) { + for (Flow flow : issue.flows()) { flowBuilder.clear(); - for (org.sonar.api.batch.sensor.issue.IssueLocation location : executionFlow.locations()) { + for (org.sonar.api.batch.sensor.issue.IssueLocation location : flow.locations()) { locationBuilder.clear(); locationBuilder.setComponentRef(componentCache.get(location.inputComponent()).batchId()); String message = location.message(); if (message != null) { locationBuilder.setMsg(message); } - applyTextRange(location.textRange()); + TextRange textRange = location.textRange(); + if (textRange != null) { + locationBuilder.setTextRange(toProtobufTextRange(textRange)); + } flowBuilder.addLocation(locationBuilder.build()); } - builder.addExecutionFlow(flowBuilder.build()); + builder.addFlow(flowBuilder.build()); } } - private void applyTextRange(TextRange primaryTextRange) { - if (primaryTextRange != null) { - textRangeBuilder.clear(); - textRangeBuilder.setStartLine(primaryTextRange.start().line()); - textRangeBuilder.setStartOffset(primaryTextRange.start().lineOffset()); - textRangeBuilder.setEndLine(primaryTextRange.end().line()); - textRangeBuilder.setEndOffset(primaryTextRange.end().lineOffset()); - locationBuilder.setTextRange(textRangeBuilder.build()); - } + private org.sonar.batch.protocol.output.BatchReport.TextRange toProtobufTextRange(TextRange primaryTextRange) { + textRangeBuilder.clear(); + textRangeBuilder.setStartLine(primaryTextRange.start().line()); + textRangeBuilder.setStartOffset(primaryTextRange.start().lineOffset()); + textRangeBuilder.setEndLine(primaryTextRange.end().line()); + textRangeBuilder.setEndOffset(primaryTextRange.end().lineOffset()); + return textRangeBuilder.build(); } private Rule validateRule(Issue issue) { diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java index 48db6fb0aae..3c452e5f53c 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/MultilineIssuesMediumTest.java @@ -29,7 +29,7 @@ import org.junit.rules.TemporaryFolder; import org.sonar.batch.mediumtest.BatchMediumTester; import org.sonar.batch.mediumtest.TaskResult; import org.sonar.batch.protocol.input.ActiveRule; -import org.sonar.batch.protocol.output.BatchReport.ExecutionFlow; +import org.sonar.batch.protocol.output.BatchReport.Flow; import org.sonar.batch.protocol.output.BatchReport.Issue; import org.sonar.batch.protocol.output.BatchReport.IssueLocation; import org.sonar.xoo.XooPlugin; @@ -76,12 +76,10 @@ public class MultilineIssuesMediumTest { Issue issue = issues.get(0); assertThat(issue.getLine()).isEqualTo(6); assertThat(issue.getMsg()).isEqualTo("Primary location"); - IssueLocation primaryLocation = issue.getPrimaryLocation(); - assertThat(primaryLocation.getMsg()).isEqualTo("Primary location"); - assertThat(primaryLocation.getTextRange().getStartLine()).isEqualTo(6); - assertThat(primaryLocation.getTextRange().getStartOffset()).isEqualTo(25); - assertThat(primaryLocation.getTextRange().getEndLine()).isEqualTo(6); - assertThat(primaryLocation.getTextRange().getEndOffset()).isEqualTo(52); + assertThat(issue.getTextRange().getStartLine()).isEqualTo(6); + assertThat(issue.getTextRange().getStartOffset()).isEqualTo(23); + assertThat(issue.getTextRange().getEndLine()).isEqualTo(6); + assertThat(issue.getTextRange().getEndOffset()).isEqualTo(50); } @Test @@ -91,47 +89,44 @@ public class MultilineIssuesMediumTest { Issue issue = issues.get(0); assertThat(issue.getLine()).isEqualTo(6); assertThat(issue.getMsg()).isEqualTo("Primary location"); - IssueLocation primaryLocation = issue.getPrimaryLocation(); - assertThat(primaryLocation.getMsg()).isEqualTo("Primary location"); - assertThat(primaryLocation.getTextRange().getStartLine()).isEqualTo(6); - assertThat(primaryLocation.getTextRange().getStartOffset()).isEqualTo(25); - assertThat(primaryLocation.getTextRange().getEndLine()).isEqualTo(7); - assertThat(primaryLocation.getTextRange().getEndOffset()).isEqualTo(23); + assertThat(issue.getTextRange().getStartLine()).isEqualTo(6); + assertThat(issue.getTextRange().getStartOffset()).isEqualTo(23); + assertThat(issue.getTextRange().getEndLine()).isEqualTo(7); + assertThat(issue.getTextRange().getEndOffset()).isEqualTo(23); } @Test - public void testMultipleIssueLocation() throws Exception { + public void testFlowWithSingleLocation() throws Exception { List issues = result.issuesFor(result.inputFile("xources/hello/Multiple.xoo")); assertThat(issues).hasSize(1); Issue issue = issues.get(0); assertThat(issue.getLine()).isEqualTo(6); assertThat(issue.getMsg()).isEqualTo("Primary location"); - IssueLocation primaryLocation = issue.getPrimaryLocation(); - assertThat(primaryLocation.getMsg()).isEqualTo("Primary location"); - assertThat(primaryLocation.getTextRange().getStartLine()).isEqualTo(6); - assertThat(primaryLocation.getTextRange().getStartOffset()).isEqualTo(25); - assertThat(primaryLocation.getTextRange().getEndLine()).isEqualTo(6); - assertThat(primaryLocation.getTextRange().getEndOffset()).isEqualTo(52); - - assertThat(issue.getAdditionalLocationList()).hasSize(1); - IssueLocation additionalLocation = issue.getAdditionalLocation(0); - assertThat(additionalLocation.getMsg()).isEqualTo("Location #2"); + assertThat(issue.getTextRange().getStartLine()).isEqualTo(6); + assertThat(issue.getTextRange().getStartOffset()).isEqualTo(23); + assertThat(issue.getTextRange().getEndLine()).isEqualTo(6); + assertThat(issue.getTextRange().getEndOffset()).isEqualTo(50); + + assertThat(issue.getFlowList()).hasSize(1); + Flow flow = issue.getFlow(0); + assertThat(flow.getLocationList()).hasSize(1); + IssueLocation additionalLocation = flow.getLocation(0); + assertThat(additionalLocation.getMsg()).isEqualTo("Flow step #1"); assertThat(additionalLocation.getTextRange().getStartLine()).isEqualTo(7); - assertThat(additionalLocation.getTextRange().getStartOffset()).isEqualTo(25); + assertThat(additionalLocation.getTextRange().getStartOffset()).isEqualTo(26); assertThat(additionalLocation.getTextRange().getEndLine()).isEqualTo(7); - assertThat(additionalLocation.getTextRange().getEndOffset()).isEqualTo(52); + assertThat(additionalLocation.getTextRange().getEndOffset()).isEqualTo(53); } @Test - public void testExecutionFlows() throws Exception { + public void testFlowsWithMultipleElements() throws Exception { List issues = result.issuesFor(result.inputFile("xources/hello/WithFlow.xoo")); assertThat(issues).hasSize(1); Issue issue = issues.get(0); - assertThat(issue.getExecutionFlowList()).hasSize(1); - - ExecutionFlow executionFlow = issue.getExecutionFlow(0); - assertThat(executionFlow.getLocationList()).hasSize(2); + assertThat(issue.getFlowList()).hasSize(1); + Flow flow = issue.getFlow(0); + assertThat(flow.getLocationList()).hasSize(2); // TODO more assertions } } diff --git a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiline.xoo b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiline.xoo index 4043133acfd..6e8a35f20a5 100644 --- a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiline.xoo +++ b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiline.xoo @@ -3,7 +3,7 @@ package hello; public class HelloJava { public static void main(String[] args) { - {xoo-start-issue:1:1}System.out - .println("Hello"){xoo-end-issue:1:1}; + {xoo-start-issue:1}System.out + .println("Hello"){xoo-end-issue:1}; } } \ No newline at end of file diff --git a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiple.xoo b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiple.xoo index c3840bf283a..b6b1b8369a4 100644 --- a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiple.xoo +++ b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Multiple.xoo @@ -3,7 +3,7 @@ package hello; public class HelloJava { public static void main(String[] args) { - {xoo-start-issue:1:1}System.out.println("Hello"){xoo-end-issue:1:1}; - {xoo-start-issue:1:2}System.out.println("World"){xoo-end-issue:1:2}; + {xoo-start-issue:1}System.out.println("Hello"){xoo-end-issue:1}; + {xoo-start-flow:1:1:1}System.out.println("World"){xoo-end-flow:1:1:1}; } } \ No newline at end of file diff --git a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Single.xoo b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Single.xoo index 0b815e09295..fc664425a99 100644 --- a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Single.xoo +++ b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/Single.xoo @@ -3,6 +3,6 @@ package hello; public class HelloJava { public static void main(String[] args) { - {xoo-start-issue:1:1}System.out.println("Hello"){xoo-end-issue:1:1}; + {xoo-start-issue:1}System.out.println("Hello"){xoo-end-issue:1}; } } \ No newline at end of file diff --git a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo index 31e11c695e9..9dc4685fe84 100644 --- a/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo +++ b/sonar-batch/src/test/resources/mediumtest/xoo/sample-multiline/xources/hello/WithFlow.xoo @@ -5,7 +5,7 @@ public class HelloJava { public static void main(String[] args) { {xoo-start-flow:1:1:1}if (true){xoo-end-flow:1:1:1} { {xoo-start-flow:1:1:2}if (true){xoo-end-flow:1:1:2} { - {xoo-start-issue:1:1}if (true){xoo-end-issue:1:1} { + {xoo-start-issue:1}if (true){xoo-end-issue:1} { System.out.println("Hello"); } } diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java index 77c6237f3d7..a1185baa607 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssueBuilder.java @@ -81,7 +81,7 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder { } @Override - public IssueBuilder addExecutionFlow(Iterable flow) { + public IssueBuilder addFlow(Iterable flow) { throw unsupported(); } @@ -90,11 +90,6 @@ public class DefaultIssueBuilder implements Issuable.IssueBuilder { throw unsupported(); } - @Override - public IssueBuilder addLocation(NewIssueLocation location) { - throw unsupported(); - } - private static UnsupportedOperationException unsupported() { return new UnsupportedOperationException("Not supported for manual issues"); } 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 locations(); - - /** - * List of execution flows for this issue. Can be empty. - * @since 5.2 - */ - List executionFlows(); + List 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 flowLocations); + NewIssue addFlow(Iterable 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, ExecutionFlow> { + private static final class ToFlow implements Function, Flow> { @Override - public ExecutionFlow apply(final List input) { - return new ExecutionFlow() { + public Flow apply(final List input) { + return new Flow() { @Override public List 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 locations = new ArrayList<>(); - private List> executionFlows = new ArrayList<>(); + private List> flows = new ArrayList<>(); private final Map 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 locations) { + public DefaultIssue addFlow(Iterable locations) { List 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 locations() { - return ImmutableList.copyOf(this.locations); - } - - @Override - public List executionFlows() { - return Lists.transform(this.executionFlows, new ToExecutionFlow()); + public List 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 flowLocations); + IssueBuilder addFlow(Iterable flowLocations); /** * Overrides the severity declared in Quality profile. Do not execute in standard use-cases. -- 2.39.5