diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-12-31 12:37:19 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-12-31 12:37:19 +0000 |
commit | 0cdd234b1a434b6d7fa4a282f5ca3ee4f2e2bd21 (patch) | |
tree | 4c571af5a912a7558e0968599bd568b73a5fab52 /src | |
parent | 31d2746757a6385f6935eae6ffaf59bb98352488 (diff) | |
download | scala-0cdd234b1a434b6d7fa4a282f5ca3ee4f2e2bd21.tar.gz scala-0cdd234b1a434b6d7fa4a282f5ca3ee4f2e2bd21.tar.bz2 scala-0cdd234b1a434b6d7fa4a282f5ca3ee4f2e2bd21.zip |
Changed the cache in the jvm backend to use a W...
Changed the cache in the jvm backend to use a WeakHashMap for names.
Added some details to mutable.WeakHashMap scaladoc.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/WeakHashMap.scala | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala index 5700236062..6a6489b4c9 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala @@ -35,7 +35,7 @@ trait GenJVMUtil { ) private val javaNameCache = { - val map = new mutable.HashMap[Symbol, String]() + val map = new mutable.WeakHashMap[Symbol, String]() map ++= List( NothingClass -> RuntimeNothingClass.fullName('/'), RuntimeNothingClass -> RuntimeNothingClass.fullName('/'), diff --git a/src/library/scala/collection/mutable/WeakHashMap.scala b/src/library/scala/collection/mutable/WeakHashMap.scala index 75bc317f4a..8ae5b0ac78 100644 --- a/src/library/scala/collection/mutable/WeakHashMap.scala +++ b/src/library/scala/collection/mutable/WeakHashMap.scala @@ -15,7 +15,9 @@ import JavaConversions._ import generic._ -/** A hash map with references to entries which are weakly reachable. +/** A hash map with references to entries which are weakly reachable. Entries are + * removed from this map when the key is no longer (strongly) referenced. This class wraps + * `java.util.WeakHashMap`. * * @tparam A type of keys contained in this map * @tparam B type of values associated with the keys |