From c7f14dbbcca0b9fb1126aeb9ffc0a7c3eb7aa035 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 5 Oct 2011 04:51:06 +0000 Subject: Consistent hashCode for Symbol. Use the string's hashcode so it is stable across jvm restarts. Closes SI-5056, no review. --- src/library/scala/Symbol.scala | 4 ++-- 1 file 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] -- cgit v1.2.3