groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [1/5] groovy git commit: Refine GPathResult's equals and hashCode
Date Wed, 06 Dec 2017 03:38:21 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 5dda23471 -> ce17f0ebb


Refine GPathResult's equals and hashCode

(cherry picked from commit 02bc1e4)

(cherry picked from commit 6acd9b7)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7c092499
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7c092499
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7c092499

Branch: refs/heads/GROOVY_2_5_X
Commit: 7c09249992c955bb1f75d2ff07d8faee7db2d3b9
Parents: 5dda234
Author: sunlan <sunlan@apache.org>
Authored: Wed Dec 6 07:46:34 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed Dec 6 11:36:13 2017 +0800

----------------------------------------------------------------------
 .../java/groovy/util/slurpersupport/GPathResult.java   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7c092499/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
b/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
index 5aca4b6..47dec63 100644
--- a/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
+++ b/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java
@@ -369,10 +369,17 @@ public abstract class GPathResult extends GroovyObjectSupport implements
Writabl
         return this;
     }
 
-    /* (non-Javadoc)
-    * @see java.lang.Object#equals(java.lang.Object)
-    */
+    @Override
+    public int hashCode() {
+        return text().hashCode();
+    }
+
+    @Override
     public boolean equals(Object obj) {
+        if (null == obj) {
+            return false;
+        }
+
         return text().equals(obj.toString());
     }
 


Mime
View raw message