You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/09/27 15:25:25 UTC

[commons-validator] branch master updated: Normalize equals() implementation

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b9c16e2 Normalize equals() implementation
8b9c16e2 is described below

commit 8b9c16e25431a934d9a915a55c561fda3c2492eb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 27 11:25:20 2023 -0400

    Normalize equals() implementation
---
 src/main/java/org/apache/commons/validator/util/Flags.java | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/validator/util/Flags.java b/src/main/java/org/apache/commons/validator/util/Flags.java
index 903aa74a..7ac5bd89 100644
--- a/src/main/java/org/apache/commons/validator/util/Flags.java
+++ b/src/main/java/org/apache/commons/validator/util/Flags.java
@@ -159,17 +159,14 @@ public class Flags implements Serializable, Cloneable {
      */
     @Override
     public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
         if (!(obj instanceof Flags)) {
             return false;
         }
-
-        if (obj == this) {
-            return true;
-        }
-
-        final Flags f = (Flags) obj;
-
-        return this.flags == f.flags;
+        Flags other = (Flags) obj;
+        return flags == other.flags;
     }
 
     /**