aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-09-12 02:26:06 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-09-12 02:26:38 +0400
commitf51d791bf3c45222086f031f75cdaeae0358883a (patch)
tree1bcd9e2fce9ac17ea824e66290f2e5af1cb7f927 /sonar-duplications
parent705bb4b9ed41d36a10864d2e0365b73c669a4028 (diff)
downloadsonarqube-f51d791bf3c45222086f031f75cdaeae0358883a.tar.gz
sonarqube-f51d791bf3c45222086f031f75cdaeae0358883a.zip
Fix violations
Diffstat (limited to 'sonar-duplications')
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/cpd/Match.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/Match.java b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/Match.java
index 0ec9a9ad72c..2541b814d2c 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/cpd/Match.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/cpd/Match.java
@@ -89,11 +89,16 @@ public class Match implements Comparable<Match> {
second = m2.getIndex();
}
+ @Override
public int hashCode() {
return first + 37 * second;
}
+ @Override
public boolean equals(Object other) {
+ if (!(other instanceof MatchCode)) {
+ return false;
+ }
MatchCode mc = (MatchCode) other;
return mc.first == first && mc.second == second;
}
@@ -145,7 +150,7 @@ public class Match implements Comparable<Match> {
}
public int compareTo(Match other) {
- int diff = other.getTokenCount() - getTokenCount();
+ int diff = other.getTokenCount() - getTokenCount(); // NOSONAR Bad practice - Class defines compareTo(...) and uses Object.equals()
if (diff != 0) {
return diff;
}
@@ -160,6 +165,7 @@ public class Match implements Comparable<Match> {
return marks[1];
}
+ @Override
public String toString() {
return "Match: " + EOL + "tokenCount = " + tokenCount + EOL + "marks = " + markSet.size();
}