diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-02-07 17:40:46 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-10-18 17:55:34 +0200 |
commit | 17947ed9ad42a0fbae5a16efac154e45b5f13b79 (patch) | |
tree | b8005db3617572254cd41ab916bfd07beba6af16 | |
parent | e19bfeebd6ce965aac4545b3ede3c12e99f7d358 (diff) | |
download | scala-17947ed9ad42a0fbae5a16efac154e45b5f13b79.tar.gz scala-17947ed9ad42a0fbae5a16efac154e45b5f13b79.tar.bz2 scala-17947ed9ad42a0fbae5a16efac154e45b5f13b79.zip |
need to synchronize Symbols.recursionTable
Fixes this glaring omission of synchronization for a core part of Symbol.info.
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 4 | ||||
-rw-r--r-- | src/reflect/scala/reflect/runtime/JavaUniverseForce.scala | 1 | ||||
-rw-r--r-- | src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 77f966b3af..ba785c14bd 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -30,7 +30,9 @@ trait Symbols extends api.Symbols { self: SymbolTable => //protected var lockedSyms = scala.collection.immutable.Set[Symbol]() /** Used to keep track of the recursion depth on locked symbols */ - private var recursionTable = immutable.Map.empty[Symbol, Int] + private var _recursionTable = immutable.Map.empty[Symbol, Int] + def recursionTable = _recursionTable + def recursionTable_=(value: immutable.Map[Symbol, Int]) = _recursionTable = value private var existentialIds = 0 protected def nextExistentialId() = { existentialIds += 1; existentialIds } diff --git a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala index f9c8b09f91..1196d17f50 100644 --- a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala +++ b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala @@ -44,6 +44,7 @@ trait JavaUniverseForce { self: runtime.JavaUniverse => // inaccessible: this._tostringRecursions // inaccessible: this.atomicIds // inaccessible: this.atomicExistentialIds + // inaccessible: this._recursionTable // inaccessible: this.mirrors this.rootMirror this.treeBuild diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala index 4a0f6ffaea..298d0ffebd 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala @@ -3,6 +3,7 @@ package reflect package runtime import scala.reflect.io.AbstractFile +import scala.collection.{ immutable, mutable } private[reflect] trait SynchronizedSymbols extends internal.Symbols { self: SymbolTable => @@ -12,6 +13,10 @@ private[reflect] trait SynchronizedSymbols extends internal.Symbols { self: Symb private lazy val atomicExistentialIds = new java.util.concurrent.atomic.AtomicInteger(0) override protected def nextExistentialId() = atomicExistentialIds.incrementAndGet() + private lazy val _recursionTable = mkThreadLocalStorage(immutable.Map.empty[Symbol, Int]) + override def recursionTable = _recursionTable.get + override def recursionTable_=(value: immutable.Map[Symbol, Int]) = _recursionTable.set(value) + // Set the fields which point companions at one another. Returns the module. override def connectModuleToClass(m: ModuleSymbol, moduleClass: ClassSymbol): ModuleSymbol = gilSynchronized { super.connectModuleToClass(m, moduleClass) } |