summaryrefslogtreecommitdiff
path: root/src/interactive
diff options
context:
space:
mode:
authorFrançois Garillot <francois@garillot.net>2014-07-29 11:51:26 +0200
committerFrançois Garillot <francois@garillot.net>2014-09-09 15:35:13 +0200
commita6946eebe6237310724d9338e141adc41bca9b4e (patch)
tree981a162a06cc59b1ef975bee61db9d1e371244ca /src/interactive
parentf43e758a2d4584709ac587933882113b05cea825 (diff)
downloadscala-a6946eebe6237310724d9338e141adc41bca9b4e.tar.gz
scala-a6946eebe6237310724d9338e141adc41bca9b4e.tar.bz2
scala-a6946eebe6237310724d9338e141adc41bca9b4e.zip
Change Synchronized(Set|Map) to Java concurrency
Diffstat (limited to 'src/interactive')
-rw-r--r--src/interactive/scala/tools/nsc/interactive/Global.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index f50153e1e2..fdedaa600c 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -19,6 +19,8 @@ import scala.annotation.{ elidable, tailrec }
import scala.language.implicitConversions
import scala.tools.nsc.typechecker.Typers
import scala.util.control.Breaks._
+import java.util.concurrent.ConcurrentHashMap
+import scala.collection.JavaConverters.mapAsScalaMapConverter
/**
* This trait allows the IDE to have an instance of the PC that
@@ -160,19 +162,18 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
/** A map of all loaded files to the rich compilation units that correspond to them.
*/
- val unitOfFile = new LinkedHashMap[AbstractFile, RichCompilationUnit] with
- SynchronizedMap[AbstractFile, RichCompilationUnit] {
+ val unitOfFile = mapAsScalaMapConverter(new ConcurrentHashMap[AbstractFile, RichCompilationUnit] {
override def put(key: AbstractFile, value: RichCompilationUnit) = {
val r = super.put(key, value)
- if (r.isEmpty) debugLog("added unit for "+key)
+ if (r == null) debugLog("added unit for "+key)
r
}
- override def remove(key: AbstractFile) = {
+ override def remove(key: Any) = {
val r = super.remove(key)
- if (r.nonEmpty) debugLog("removed unit for "+key)
+ if (r != null) debugLog("removed unit for "+key)
r
}
- }
+ }).asScala
/** A set containing all those files that need to be removed
* Units are removed by getUnit, typically once a unit is finished compiled.