aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2022-02-22 16:00:47 +0100
committersonartech <sonartech@sonarsource.com>2022-02-24 20:02:52 +0000
commit1457934dc1e472cfd7d22fe098ee8bc2a1141511 (patch)
tree3ba8bba84152ce95d1d46bddd78354c35a50ea99 /sonar-core/src
parent952c70ec25d416f7f660677ca260e41864a4ccbd (diff)
downloadsonarqube-1457934dc1e472cfd7d22fe098ee8bc2a1141511.tar.gz
sonarqube-1457934dc1e472cfd7d22fe098ee8bc2a1141511.zip
SONAR-7496 drop unused columns on Issues table
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java36
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java23
2 files changed, 10 insertions, 49 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 6ea5ecbde85..198bc25d418 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
@@ -22,7 +22,6 @@ package org.sonar.core.issue;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.io.Serializable;
import java.util.ArrayList;
@@ -75,7 +74,6 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
private String resolution;
private String assigneeUuid;
private String checksum;
- private Map<String, String> attributes = null;
private String authorLogin = null;
private List<DefaultIssueComment> comments = null;
private Set<String> tags = null;
@@ -475,37 +473,23 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
return this;
}
+ /**
+ * @deprecated since 9.4, attribute was already not returning any element since 5.2
+ */
+ @Deprecated
@Override
@CheckForNull
public String attribute(String key) {
- return attributes == null ? null : attributes.get(key);
- }
-
- public DefaultIssue setAttribute(String key, @Nullable String value) {
- if (attributes == null) {
- attributes = new HashMap<>();
- }
- if (value == null) {
- attributes.remove(key);
- } else {
- attributes.put(key, value);
- }
- return this;
+ return null;
}
+ /**
+ * @deprecated since 9.4, attribute was already not returning any element since 5.2
+ */
+ @Deprecated
@Override
public Map<String, String> attributes() {
- return attributes == null ? Collections.emptyMap() : ImmutableMap.copyOf(attributes);
- }
-
- public DefaultIssue setAttributes(@Nullable Map<String, String> map) {
- if (map != null) {
- if (attributes == null) {
- attributes = new HashMap<>();
- }
- attributes.putAll(map);
- }
- return this;
+ return new HashMap<>();
}
@Override
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 1d0eebe493a..97797a5a496 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
@@ -117,29 +117,6 @@ public class DefaultIssueTest {
}
@Test
- public void test_attributes() {
- assertThat(issue.attribute("foo")).isNull();
- issue.setAttribute("foo", "bar");
- assertThat(issue.attribute("foo")).isEqualTo("bar");
- issue.setAttribute("foo", "newbar");
- assertThat(issue.attribute("foo")).isEqualTo("newbar");
- issue.setAttribute("foo", null);
- assertThat(issue.attribute("foo")).isNull();
- }
-
- @Test
- public void setAttributes_should_not_clear_existing_values() {
- issue.setAttributes(ImmutableMap.of("1", "one"));
- assertThat(issue.attribute("1")).isEqualTo("one");
-
- issue.setAttributes(ImmutableMap.of("2", "two"));
- assertThat(issue.attributes()).containsOnly(entry("1", "one"), entry("2", "two"));
-
- issue.setAttributes(null);
- assertThat(issue.attributes()).containsOnly(entry("1", "one"), entry("2", "two"));
- }
-
- @Test
public void fail_on_empty_status() {
try {
issue.setStatus("");