Skip to content

Commit

Permalink
Revert "Fix quality flaws"
Browse files Browse the repository at this point in the history
This reverts commit 7efdaa4.
  • Loading branch information
julienlancelot committed Feb 23, 2015
1 parent c43ee48 commit cc12644
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 19 deletions.
Expand Up @@ -23,7 +23,6 @@

import javax.annotation.CheckForNull;
import javax.annotation.Nullable;

import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -124,7 +123,7 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (this.getClass() != o.getClass()) {
if (o == null || getClass() != o.getClass()) {
return false;
}
Message message = (Message) o;
Expand Down
Expand Up @@ -71,12 +71,17 @@ public boolean equals(Object o) {
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
Expand Down
Expand Up @@ -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>.
Expand Down Expand Up @@ -91,7 +92,7 @@ public Terminator(int i) {

@Override
public boolean equals(Object obj) {
return (this.getClass() == obj.getClass()) && (((Terminator) obj).stringNumber == stringNumber);
return (obj instanceof Terminator) && (((Terminator) obj).stringNumber == stringNumber);
}

@Override
Expand Down
Expand Up @@ -135,7 +135,7 @@ public String toString() {
*/
@Override
public boolean equals(Object object) {
if (this.getClass() != object.getClass()) {
if (!(object instanceof CloneGroup)) {
return false;
}
CloneGroup another = (CloneGroup) object;
Expand Down
Expand Up @@ -64,7 +64,7 @@ public int getLines() {

@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
Expand Down
Expand Up @@ -82,7 +82,7 @@ public int hashCode() {

@Override
public boolean equals(Object obj) {
if (this.getClass() != obj.getClass()) {
if (!(obj instanceof Statement)) {
return false;
}
Statement other = (Statement) obj;
Expand Down
Expand Up @@ -50,7 +50,7 @@ public String getValue() {

@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);
}
Expand Down
Expand Up @@ -121,8 +121,8 @@ public String getFieldValue(String field) {
}

@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) {
Expand Down
Expand Up @@ -104,12 +104,12 @@ public String getKey() {

@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());
}
Expand Down
Expand Up @@ -101,12 +101,12 @@ private void validate() {

@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())
Expand Down

0 comments on commit cc12644

Please sign in to comment.