diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java @ 18676:1c12cf39281d

Truffle/Source: redefine equality of FileSource objects strictly in terms of the canonicalized file path, for use as hash key.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Sun, 14 Dec 2014 18:10:05 -0800
parents f17b2a0303db
children bdb24e259c11
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Sun Dec 14 13:43:02 2014 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Sun Dec 14 18:10:05 2014 -0800
@@ -599,6 +599,23 @@
         }
 
         @Override
+        public int hashCode() {
+            return path.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof FileSource) {
+                FileSource other = (FileSource) obj;
+                return path.equals(other.path);
+            }
+            return false;
+        }
+
+        @Override
         protected void reset() {
             this.code = null;
         }