Skip to content

Commit 9b07cd2

Browse files
authored
Merge pull request #156 from scala/backport-lts-3.3-22230
Backport "replace deprecated AnyRefMap" to 3.3 LTS
2 parents 915816a + a9459dc commit 9b07cd2

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
515515
*/
516516
object locals {
517517

518-
private val slots = mutable.AnyRefMap.empty[Symbol, Local] // (local-or-param-sym -> Local(BType, name, idx, isSynth))
518+
private val slots = mutable.HashMap.empty[Symbol, Local] // (local-or-param-sym -> Local(BType, name, idx, isSynth))
519519

520520
private var nxtIdx = -1 // next available index for local-var
521521

compiler/src/dotty/tools/dotc/classpath/DirectoryClassPath.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ final class CtSymClassPath(ctSym: java.nio.file.Path, release: Int) extends Clas
229229

230230
// e.g. "java.lang" -> Seq(/876/java/lang, /87/java/lang, /8/java/lang))
231231
private val packageIndex: scala.collection.Map[String, scala.collection.Seq[Path]] = {
232-
val index = collection.mutable.AnyRefMap[String, collection.mutable.ListBuffer[Path]]()
232+
val index = collection.mutable.HashMap[String, collection.mutable.ListBuffer[Path]]()
233233
val isJava12OrHigher = scala.util.Properties.isJavaAtLeast("12")
234234
rootsForRelease.foreach(root => Files.walk(root).iterator().asScala.filter(Files.isDirectory(_)).foreach { p =>
235235
val moduleNamePathElementCount = if (isJava12OrHigher) 1 else 0

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
162162
private val entries = new Array[AnyRef](index.length)
163163

164164
/** A map from symbols to their associated `decls` scopes */
165-
private val symScopes = mutable.AnyRefMap[Symbol, Scope]()
165+
private val symScopes = mutable.HashMap[Symbol, Scope]()
166166

167167
/** A mapping from method types to the parameters used in constructing them */
168168
private val paramsOfMethodType = new java.util.IdentityHashMap[MethodType, List[Symbol]]

compiler/src/dotty/tools/dotc/typer/Namer.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,30 @@ class Namer { typer: Typer =>
6464
/** A partial map from unexpanded member and pattern defs and to their expansions.
6565
* Populated during enterSyms, emptied during typer.
6666
*/
67-
//lazy val expandedTree = new mutable.AnyRefMap[DefTree, Tree]
67+
//lazy val expandedTree = new mutable.HashMap[DefTree, Tree]
6868
/*{
69-
override def default(tree: DefTree) = tree // can't have defaults on AnyRefMaps :-(
69+
override def default(tree: DefTree) = tree // can't have defaults on HashMaps :-(
7070
}*/
7171

7272
/** A map from expanded MemberDef, PatDef or Import trees to their symbols.
7373
* Populated during enterSyms, emptied at the point a typed tree
7474
* with the same symbol is created (this can be when the symbol is completed
7575
* or at the latest when the tree is typechecked.
7676
*/
77-
//lazy val symOfTree = new mutable.AnyRefMap[Tree, Symbol]
77+
//lazy val symOfTree = new mutable.HashMap[Tree, Symbol]
7878

7979
/** A map from expanded trees to their typed versions.
8080
* Populated when trees are typechecked during completion (using method typedAhead).
8181
*/
82-
// lazy val typedTree = new mutable.AnyRefMap[Tree, tpd.Tree]
82+
// lazy val typedTree = new mutable.HashMap[Tree, tpd.Tree]
8383

8484
/** A map from method symbols to nested typers.
8585
* Populated when methods are completed. Emptied when they are typechecked.
8686
* The nested typer contains new versions of the four maps above including this
8787
* one, so that trees that are shared between different DefDefs can be independently
8888
* used as indices. It also contains a scope that contains nested parameters.
8989
*/
90-
lazy val nestedTyper: mutable.AnyRefMap[Symbol, Typer] = new mutable.AnyRefMap
90+
lazy val nestedTyper: mutable.HashMap[Symbol, Typer] = new mutable.HashMap
9191

9292
/** We are entering symbols coming from a SourceLoader */
9393
private var lateCompile = false

compiler/src/dotty/tools/dotc/util/FreshNameCreator.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract class FreshNameCreator {
1414
object FreshNameCreator {
1515
class Default extends FreshNameCreator {
1616
protected var counter: Int = 0
17-
protected val counters: mutable.Map[String, Int] = mutable.AnyRefMap() withDefaultValue 0
17+
protected val counters: mutable.Map[String, Int] = mutable.HashMap() withDefaultValue 0
1818

1919
/**
2020
* Create a fresh name with the given prefix. It is guaranteed

library/src/scala/runtime/coverage/Invoker.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package scala.runtime.coverage
33
import scala.annotation.internal.sharable
44
import scala.annotation.nowarn
55
import scala.collection.concurrent.TrieMap
6-
import scala.collection.mutable.{BitSet, AnyRefMap}
6+
import scala.collection.mutable.{BitSet, HashMap}
77
import java.io.{File, FileWriter}
88
import java.nio.file.Files
99

@@ -12,7 +12,7 @@ object Invoker {
1212
private val runtimeUUID = java.util.UUID.randomUUID()
1313

1414
private val MeasurementsPrefix = "scoverage.measurements."
15-
private val threadFiles = new ThreadLocal[AnyRefMap[String, FileWriter]]
15+
private val threadFiles = new ThreadLocal[HashMap[String, FileWriter]]
1616
private val dataDirToSet = TrieMap.empty[String, BitSet]
1717

1818
/** We record that the given id has been invoked by appending its id to the coverage data file.
@@ -38,7 +38,7 @@ object Invoker {
3838
if added then
3939
var writers = threadFiles.get()
4040
if writers == null then
41-
writers = AnyRefMap.empty
41+
writers = HashMap.empty
4242
threadFiles.set(writers)
4343
val writer = writers.getOrElseUpdate(
4444
dataDir,

0 commit comments

Comments
 (0)