Mercurial > hg > graal-compiler
changeset 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 | 72d0cd2eeca4 |
children | 8d8523ed37e3 |
files | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
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; }