Skip to content

Commit 04fb40d

Browse files
committed
main cache is util.HashMap
1 parent 4bffbc5 commit 04fb40d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class ExtractDependencies extends Phase {
7676
collector.traverse(unit.tpdTree)
7777

7878
if (ctx.settings.YdumpSbtInc.value) {
79-
val deps = rec.foundDeps.map { case (clazz, found) => s"$clazz: ${found.classesString}" }.toArray[Object]
80-
val names = rec.foundDeps.map { case (clazz, found) => s"$clazz: ${found.namesString}" }.toArray[Object]
79+
val deps = rec.foundDeps.iterator.map { case (clazz, found) => s"$clazz: ${found.classesString}" }.toArray[Object]
80+
val names = rec.foundDeps.iterator.map { case (clazz, found) => s"$clazz: ${found.namesString}" }.toArray[Object]
8181
Arrays.sort(deps)
8282
Arrays.sort(names)
8383

@@ -325,7 +325,7 @@ class DependencyRecorder {
325325
/** A map from a non-local class to the names and classes it uses, this does not include
326326
* names which are only defined and not referenced.
327327
*/
328-
def foundDeps: collection.Map[Symbol, FoundDepsInClass] = _foundDeps
328+
def foundDeps: util.ReadOnlyMap[Symbol, FoundDepsInClass] = _foundDeps
329329

330330
/** Record a reference to the name of `sym` from the current non-local
331331
* enclosing class.
@@ -429,13 +429,13 @@ class DependencyRecorder {
429429
if (fromClass.exists)
430430
lastFoundCache.addDependency(toClass, context)
431431

432-
private val _foundDeps = new mutable.HashMap[Symbol, FoundDepsInClass]
432+
private val _foundDeps = new util.EqHashMap[Symbol, FoundDepsInClass]
433433

434434
/** Send the collected dependency information to Zinc and clear the local caches. */
435435
def sendToZinc()(using Context): Unit =
436436
ctx.withIncCallback: cb =>
437437
val siblingClassfiles = new mutable.HashMap[PlainFile, Path]
438-
foundDeps.foreach:
438+
_foundDeps.iterator.foreach:
439439
case (clazz, foundDeps) =>
440440
val className = classNameAsString(clazz)
441441
foundDeps.names.foreach: (usedName, scopes) =>

0 commit comments

Comments
 (0)