diff options
Diffstat (limited to 'sonar-plugin-api')
3 files changed, 8 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java index 0666e7260f1..42eca231134 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java @@ -121,8 +121,8 @@ public class Notification implements Serializable { } @Override - public boolean equals(Object obj) { - if (!(obj instanceof Notification)) { + public boolean equals(@Nullable Object obj) { + if (obj == null || this.getClass() != obj.getClass()) { return false; } if (this == obj) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java index 683f52cde43..7f83179429f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java @@ -104,12 +104,12 @@ public class ActiveRuleParam implements Cloneable { @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()); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java index d9ac5cb7813..1445f50883d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java @@ -101,12 +101,12 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction { @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()) |