diff options
Diffstat (limited to 'sonar-duplications/src')
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); } |