aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-07-26 11:25:34 -0500
committersonartech <sonartech@sonarsource.com>2022-08-02 20:04:05 +0000
commit6a32765903d0d2162f04172f811206ab9a78a435 (patch)
tree2c7282f7516686a1b515a70d066744c7fc4ed202 /sonar-core/src
parentb43d59a860d38e0bd9399f43a3d028ed96fc85b9 (diff)
downloadsonarqube-6a32765903d0d2162f04172f811206ab9a78a435.tar.gz
sonarqube-6a32765903d0d2162f04172f811206ab9a78a435.zip
SONAR-16583 Collection of hashes of issue locations takes too long
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java13
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java4
2 files changed, 17 insertions, 0 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
index 4f92924e0c4..b48470bcc01 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
@@ -104,6 +104,9 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
// true if the issue is being copied between branch
private boolean isCopied = false;
+ // true if any of the locations have changed (ignoring hashes)
+ private boolean locationsChanged = false;
+
// True if the issue did exist in the previous scan but not in the current one. That means
// that this issue should be closed.
private boolean beingClosed = false;
@@ -399,6 +402,16 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
return this;
}
+ public boolean locationsChanged() {
+ return locationsChanged;
+ }
+
+ public DefaultIssue setLocationsChanged(boolean locationsChanged) {
+ this.locationsChanged = locationsChanged;
+ return this;
+ }
+
+
public DefaultIssue setNew(boolean b) {
isNew = b;
return this;
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
index e63651e7a43..2a5091278b8 100644
--- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
@@ -54,6 +54,8 @@ public class DefaultIssueTest {
.setAssigneeUuid("julien")
.setAuthorLogin("steph")
.setChecksum("c7b5db46591806455cf082bb348631e8")
+ .setLocations("loc")
+ .setLocationsChanged(true)
.setNew(true)
.setIsOnChangedLine(true)
.setIsNewCodeReferenceIssue(true)
@@ -69,6 +71,8 @@ public class DefaultIssueTest {
.setSelectedAt(1400000000000L)
.setRuleDescriptionContextKey(TEST_CONTEXT_KEY);
+ assertThat((Object) issue.getLocations()).isEqualTo("loc");
+ assertThat(issue.locationsChanged()).isTrue();
assertThat(issue.key()).isEqualTo("ABCD");
assertThat(issue.componentKey()).isEqualTo("org.sample.Sample");
assertThat(issue.projectKey()).isEqualTo("Sample");