You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/06/11 17:50:30 UTC

[tomcat] branch 8.5.x updated: Implement equals() and hashCode() because compareTo() is implemented

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

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 0c598b1  Implement equals() and hashCode() because compareTo() is implemented
0c598b1 is described below

commit 0c598b1d04c147c9976e734a7d2fcaf74db48593
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jun 11 18:23:26 2019 +0100

    Implement equals() and hashCode() because compareTo() is implemented
---
 java/javax/el/Util.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index 1dfd0a8..0ec663c 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -809,6 +809,26 @@ class Util {
             }
             return cmp;
         }
+
+        @Override
+        public boolean equals(Object o)
+        {
+            return o == this || (null != o &&
+                    this.getClass().equals(o.getClass()) &&
+                    ((MatchResult)o).getExact() == this.getExact() &&
+                    ((MatchResult)o).getAssignable() == this.getAssignable() &&
+                    ((MatchResult)o).getCoercible() == this.getCoercible() &&
+                    ((MatchResult)o).isBridge() == this.isBridge());
+        }
+
+        @Override
+        public int hashCode()
+        {
+            return (this.isBridge() ? 1 << 24 : 0) ^
+                    this.getExact() << 16 ^
+                    this.getAssignable() << 8 ^
+                    this.getCoercible();
+        }
     }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org