diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-12-11 18:03:00 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-01-16 23:18:12 +0100 |
commit | ff9512812c6619d6ab5a1dde99c9569a3b27c813 (patch) | |
tree | 2df773f7a55912a2946a6ea8d0faa4e675b0997e | |
parent | 45efefaa9b16532c1f61560bde09a7346dcfe5a1 (diff) | |
download | scala-ff9512812c6619d6ab5a1dde99c9569a3b27c813.tar.gz scala-ff9512812c6619d6ab5a1dde99c9569a3b27c813.tar.bz2 scala-ff9512812c6619d6ab5a1dde99c9569a3b27c813.zip |
Remove an unnecessary hash map in BTypesFromSymbols
There's already the map classBTypeFromInternalNameMap in BTypes which
stores all ClassBTypes.
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala index ef18d29841..0582088710 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala @@ -41,11 +41,6 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { global.perRunCaches.recordCache(collection.concurrent.TrieMap.empty[InternalName, ClassBType]) } - /** - * Cache for the method classBTypeFromSymbol. - */ - private val convertedClasses = perRunCaches.newMap[Symbol, ClassBType]() - // helpers that need access to global. // TODO @lry create a separate component, they don't belong to BTypesFromSymbols @@ -88,13 +83,11 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { (classSym != NothingClass && classSym != NullClass), s"Cannot create ClassBType for special class symbol ${classSym.fullName}") - convertedClasses.getOrElse(classSym, { - val internalName = classSym.javaBinaryName.toString - // We first create and add the ClassBType to the hash map before computing its info. This - // allows initializing cylic dependencies, see the comment on variable ClassBType._info. - val classBType = ClassBType(internalName) - convertedClasses(classSym) = classBType - setClassInfo(classSym, classBType) + val internalName = classSym.javaBinaryName.toString + classBTypeFromInternalNameMap.getOrElse(internalName, { + // The new ClassBType is added to the map in its constructor, before we set its info. This + // allows initializing cyclic dependencies, see the comment on variable ClassBType._info. + setClassInfo(classSym, ClassBType(internalName)) }) } |