groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Add `equals` and `hashCode` method to `ASTNode`
Date Sat, 13 Jan 2018 12:30:32 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 815968dd6 -> dde9aa2cf


Add `equals` and `hashCode` method to `ASTNode`

(cherry picked from commit e003776)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: dde9aa2cf336b40c4a7dcbd2a7fef9e27ffc9d2e
Parents: 815968d
Author: sunlan <sunlan@apache.org>
Authored: Sat Jan 13 19:53:15 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Sat Jan 13 20:30:24 2018 +0800

----------------------------------------------------------------------
 src/main/java/org/codehaus/groovy/ast/ASTNode.java | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/dde9aa2c/src/main/java/org/codehaus/groovy/ast/ASTNode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/ASTNode.java b/src/main/java/org/codehaus/groovy/ast/ASTNode.java
index 058af78..d8ef876 100644
--- a/src/main/java/org/codehaus/groovy/ast/ASTNode.java
+++ b/src/main/java/org/codehaus/groovy/ast/ASTNode.java
@@ -23,6 +23,7 @@ import org.codehaus.groovy.util.ListHashMap;
 
 import java.util.Collections;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * Base class for any AST node. This class supports basic information used in all nodes of
the AST:
@@ -197,4 +198,14 @@ public class ASTNode {
     public ListHashMap getMetaDataMap() {
         return metaDataMap;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        return this == o;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(lineNumber, columnNumber, lastLineNumber, lastColumnNumber);
+    }
 }


Mime
View raw message