aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-02-23 12:02:14 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-02-23 12:02:14 +0100
commitcc12644634a2b5d5d2d63764f4e0f97fc3ed333d (patch)
tree0d17f4cade8972fd87381bf273a61c2c463b05c6
parentc43ee4857c97e583433997678ddaebeb7ec68722 (diff)
downloadsonarqube-cc12644634a2b5d5d2d63764f4e0f97fc3ed333d.tar.gz
sonarqube-cc12644634a2b5d5d2d63764f4e0f97fc3ed333d.zip
Revert "Fix quality flaws"
This reverts commit 7efdaa4a6e4f2ce8cbcc024e74407ccb13a413d3.
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/Result.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java9
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java7
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/token/Token.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java6
10 files changed, 24 insertions, 19 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java b/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java
index 330f60e74ab..49d56286d9a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java
@@ -23,7 +23,6 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-
import java.util.Arrays;
import java.util.List;
@@ -124,7 +123,7 @@ public class Result<T> {
if (this == o) {
return true;
}
- if (this.getClass() != o.getClass()) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
Message message = (Message) o;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java b/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java
index 8567a40d295..920b84c60dc 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java
@@ -71,12 +71,17 @@ public class RulesAggregation {
if (this == o) {
return true;
}
- if (this.getClass() != o.getClass()) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
Rule rule = (Rule) o;
- return ruleKey.equals(rule.ruleKey);
+
+ if (!ruleKey.equals(rule.ruleKey)) {
+ return false;
+ }
+
+ return true;
}
@Override
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
index 51ecbe54294..82ab1db55a6 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
@@ -19,10 +19,11 @@
*/
package org.sonar.duplications.detector.suffixtree;
-import com.google.common.collect.Lists;
+import java.util.List;
+
import org.sonar.duplications.block.Block;
-import java.util.List;
+import com.google.common.collect.Lists;
/**
* Simplifies construction of <a href="http://en.wikipedia.org/wiki/Generalised_suffix_tree">generalised suffix-tree</a>.
@@ -91,7 +92,7 @@ public final class TextSet extends AbstractText {
@Override
public boolean equals(Object obj) {
- return (this.getClass() == obj.getClass()) && (((Terminator) obj).stringNumber == stringNumber);
+ return (obj instanceof Terminator) && (((Terminator) obj).stringNumber == stringNumber);
}
@Override
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java
index b840c2f55f0..01b7273da1c 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java
@@ -135,7 +135,7 @@ public class CloneGroup {
*/
@Override
public boolean equals(Object object) {
- if (this.getClass() != object.getClass()) {
+ if (!(object instanceof CloneGroup)) {
return false;
}
CloneGroup another = (CloneGroup) object;
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java
index 630f52c1350..6a569e27eae 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java
@@ -64,7 +64,7 @@ public class ClonePart implements CodeFragment {
@Override
public boolean equals(Object obj) {
- if (this.getClass() == obj.getClass()) {
+ if (obj instanceof ClonePart) {
ClonePart another = (ClonePart) obj;
return another.resourceId.equals(resourceId)
&& another.startLine == startLine
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java
index dc1c8ac402d..49e9e90f743 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java
@@ -82,7 +82,7 @@ public class Statement implements CodeFragment {
@Override
public boolean equals(Object obj) {
- if (this.getClass() != obj.getClass()) {
+ if (!(obj instanceof Statement)) {
return false;
}
Statement other = (Statement) obj;
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/token/Token.java b/sonar-duplications/src/main/java/org/sonar/duplications/token/Token.java
index c1c374e7f52..06525a4ccda 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/token/Token.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/token/Token.java
@@ -50,7 +50,7 @@ public class Token {
@Override
public boolean equals(Object object) {
- if (this.getClass() == object.getClass()) {
+ if (object instanceof Token) {
Token anotherToken = (Token) object;
return anotherToken.line == line && anotherToken.column == column && anotherToken.value.equals(value);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java
index 42eca231134..0666e7260f1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java
@@ -121,8 +121,8 @@ public class Notification implements Serializable {
}
@Override
- public boolean equals(@Nullable Object obj) {
- if (obj == null || this.getClass() != obj.getClass()) {
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Notification)) {
return false;
}
if (this == obj) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
index 7f83179429f..683f52cde43 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
@@ -104,12 +104,12 @@ public class ActiveRuleParam implements Cloneable {
@Override
public boolean equals(Object obj) {
+ if (!(obj instanceof ActiveRuleParam)) {
+ return false;
+ }
if (this == obj) {
return true;
}
- if (this.getClass() != obj.getClass()) {
- return false;
- }
ActiveRuleParam other = (ActiveRuleParam) obj;
return other.getKey().equals(getKey());
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
index 1445f50883d..d9ac5cb7813 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
@@ -101,12 +101,12 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
@Override
public boolean equals(Object o) {
+ if (!(o instanceof DefaultDebtRemediationFunction)) {
+ return false;
+ }
if (this == o) {
return true;
}
- if (this.getClass() != o.getClass()) {
- return false;
- }
DefaultDebtRemediationFunction other = (DefaultDebtRemediationFunction) o;
return new EqualsBuilder()
.append(coefficient, other.coefficient())