aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications/src/main/java
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-02-23 09:50:27 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-02-23 10:43:33 +0100
commit7efdaa4a6e4f2ce8cbcc024e74407ccb13a413d3 (patch)
treebf6b55758b269db80629c6098f0a094d72dddbab /sonar-duplications/src/main/java
parentea5a39cadb0f8acf8a95f26b6d9392a9115d4818 (diff)
downloadsonarqube-7efdaa4a6e4f2ce8cbcc024e74407ccb13a413d3.tar.gz
sonarqube-7efdaa4a6e4f2ce8cbcc024e74407ccb13a413d3.zip
Fix quality flaws
Diffstat (limited to 'sonar-duplications/src/main/java')
-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
5 files changed, 7 insertions, 8 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 82ab1db55a6..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
@@ -19,11 +19,10 @@
*/
package org.sonar.duplications.detector.suffixtree;
-import java.util.List;
-
+import com.google.common.collect.Lists;
import org.sonar.duplications.block.Block;
-import com.google.common.collect.Lists;
+import java.util.List;
/**
* Simplifies construction of <a href="http://en.wikipedia.org/wiki/Generalised_suffix_tree">generalised suffix-tree</a>.
@@ -92,7 +91,7 @@ public final class TextSet extends AbstractText {
@Override
public boolean equals(Object obj) {
- return (obj instanceof Terminator) && (((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 01b7273da1c..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
@@ -135,7 +135,7 @@ public class CloneGroup {
*/
@Override
public boolean equals(Object object) {
- if (!(object instanceof CloneGroup)) {
+ 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 6a569e27eae..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
@@ -64,7 +64,7 @@ public class ClonePart implements CodeFragment {
@Override
public boolean equals(Object obj) {
- if (obj instanceof ClonePart) {
+ 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 49e9e90f743..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
@@ -82,7 +82,7 @@ public class Statement implements CodeFragment {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof Statement)) {
+ 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 06525a4ccda..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
@@ -50,7 +50,7 @@ public class Token {
@Override
public boolean equals(Object object) {
- if (object instanceof Token) {
+ if (this.getClass() == object.getClass()) {
Token anotherToken = (Token) object;
return anotherToken.line == line && anotherToken.column == column && anotherToken.value.equals(value);
}