You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/03/04 14:20:59 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #1541: Replace use of equals() with Object.equals()

ctubbsii commented on a change in pull request #1541: Replace use of equals() with Object.equals()
URL: https://github.com/apache/accumulo/pull/1541#discussion_r387694367
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/data/Condition.java
 ##########
 @@ -308,41 +309,20 @@ public Condition setIterators(IteratorSetting... iterators) {
 
   @Override
   public boolean equals(Object o) {
-    if (o == this) {
+    if (this == o)
       return true;
-    }
-    if (o == null || !(o instanceof Condition)) {
-      return false;
-    }
-    Condition c = (Condition) o;
-    if (!(c.cf.equals(cf))) {
-      return false;
-    }
-    if (!(c.cq.equals(cq))) {
-      return false;
-    }
-    if (!(c.cv.equals(cv))) {
+    if (o == null || getClass() != o.getClass())
 
 Review comment:
   This was changed from `instanceof` to the use of `getClass()`, which is not the same. The latter is more narrow. I think it should be changed back to `instanceof`, although the check for null would be redundant, since `instanceof` is always false if it's null.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services