summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-05 04:51:06 +0000
committerPaul Phillips <paulp@improving.org>2011-10-05 04:51:06 +0000
commitc7f14dbbcca0b9fb1126aeb9ffc0a7c3eb7aa035 (patch)
tree93f58fa890e310a3106efd3414547d9e8691a373
parent97b41d36b6eaca0d0347590ba408f8c8e2dc0709 (diff)
downloadscala-c7f14dbbcca0b9fb1126aeb9ffc0a7c3eb7aa035.tar.gz
scala-c7f14dbbcca0b9fb1126aeb9ffc0a7c3eb7aa035.tar.bz2
scala-c7f14dbbcca0b9fb1126aeb9ffc0a7c3eb7aa035.zip
Consistent hashCode for Symbol.
Use the string's hashcode so it is stable across jvm restarts. Closes SI-5056, no review.
-rw-r--r--src/library/scala/Symbol.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/Symbol.scala b/src/library/scala/Symbol.scala
index 2cf8e21483..8a17ae87b0 100644
--- a/src/library/scala/Symbol.scala
+++ b/src/library/scala/Symbol.scala
@@ -6,8 +6,6 @@
** |/ **
\* */
-
-
package scala
/** This class provides a simple way to get unique objects for equal strings.
@@ -29,6 +27,8 @@ final class Symbol private (val name: String) extends Serializable {
@throws(classOf[java.io.ObjectStreamException])
private def readResolve(): Any = Symbol.apply(name)
+ override def hashCode = name.hashCode()
+ override def equals(other: Any) = this eq other.asInstanceOf[AnyRef]
}
object Symbol extends UniquenessCache[String, Symbol]