aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications/src/main/java
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-02-23 12:02:00 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-02-23 12:02:00 +0100
commitc43ee4857c97e583433997678ddaebeb7ec68722 (patch)
treebf6b55758b269db80629c6098f0a094d72dddbab /sonar-duplications/src/main/java
parent3c5fec7277657389960231c8ee650256028a1d7a (diff)
downloadsonarqube-c43ee4857c97e583433997678ddaebeb7ec68722.tar.gz
sonarqube-c43ee4857c97e583433997678ddaebeb7ec68722.zip
Revert "Add missing null check on equals"
This reverts commit 3c5fec7277657389960231c8ee650256028a1d7a.
Diffstat (limited to 'sonar-duplications/src/main/java')
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java6
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java6
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java6
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/token/Token.java6
5 files changed, 9 insertions, 17 deletions
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 e92398b26f5..51ecbe54294 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
@@ -91,7 +91,7 @@ public final class TextSet extends AbstractText {
@Override
public boolean equals(Object obj) {
- return obj != null && this.getClass() == obj.getClass() && (((Terminator) obj).stringNumber == stringNumber);
+ return (this.getClass() == obj.getClass()) && (((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 818e018d4bb..b840c2f55f0 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
@@ -23,8 +23,6 @@ import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import javax.annotation.Nullable;
-
import java.util.ArrayList;
import java.util.List;
@@ -136,8 +134,8 @@ public class CloneGroup {
* Two groups are equal, if they have same length, same origins and contain same parts in same order.
*/
@Override
- public boolean equals(@Nullable Object object) {
- if (object == null || this.getClass() != object.getClass()) {
+ public boolean equals(Object object) {
+ if (this.getClass() != object.getClass()) {
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 0130f167197..630f52c1350 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
@@ -21,8 +21,6 @@ package org.sonar.duplications.index;
import org.sonar.duplications.CodeFragment;
-import javax.annotation.Nullable;
-
public class ClonePart implements CodeFragment {
private final String resourceId;
@@ -65,8 +63,8 @@ public class ClonePart implements CodeFragment {
}
@Override
- public boolean equals(@Nullable Object obj) {
- if (obj != null && this.getClass() == obj.getClass()) {
+ public boolean equals(Object obj) {
+ if (this.getClass() == obj.getClass()) {
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 f698e61805b..dc1c8ac402d 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
@@ -22,8 +22,6 @@ package org.sonar.duplications.statement;
import org.sonar.duplications.CodeFragment;
import org.sonar.duplications.token.Token;
-import javax.annotation.Nullable;
-
import java.util.List;
public class Statement implements CodeFragment {
@@ -83,8 +81,8 @@ public class Statement implements CodeFragment {
}
@Override
- public boolean equals(@Nullable Object obj) {
- if (obj == null || this.getClass() != obj.getClass()) {
+ public boolean equals(Object obj) {
+ if (this.getClass() != obj.getClass()) {
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 e738ebc404e..c1c374e7f52 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
@@ -19,8 +19,6 @@
*/
package org.sonar.duplications.token;
-import javax.annotation.Nullable;
-
public class Token {
private final int line;
@@ -51,8 +49,8 @@ public class Token {
}
@Override
- public boolean equals(@Nullable Object object) {
- if (object != null && this.getClass() == object.getClass()) {
+ public boolean equals(Object object) {
+ if (this.getClass() == object.getClass()) {
Token anotherToken = (Token) object;
return anotherToken.line == line && anotherToken.column == column && anotherToken.value.equals(value);
}