Skip to content

Commit 7e58d87

Browse files
authored
Merge pull request scala/scala#10862 from wangyum/AnyRefMap
Deprecate mutable.AnyRefMap
2 parents 47af6d7 + 334252c commit 7e58d87

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

library/src/scala/collection/generic/IsMap.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ object IsMap {
7575
}
7676

7777
// AnyRefMap has stricter bounds than the ones used by the mapOpsIsMap definition
78+
@deprecated("AnyRefMap is deprecated", "2.13.16")
7879
implicit def anyRefMapIsMap[K0 <: AnyRef, V0]: IsMap[mutable.AnyRefMap[K0, V0]] { type K = K0; type V = V0; type C = mutable.AnyRefMap[K0, V0] } =
7980
new IsMap[mutable.AnyRefMap[K0, V0]] {
8081
type K = K0

library/src/scala/collection/mutable/AnyRefMap.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ package scala
1414
package collection
1515
package mutable
1616

17+
import scala.annotation.meta.companionClass
1718
import scala.annotation.nowarn
1819
import scala.collection.generic.DefaultSerializationProxy
1920
import scala.language.implicitConversions
@@ -41,6 +42,7 @@ import scala.language.implicitConversions
4142
* rapidly as 2^30^ is approached.
4243
*
4344
*/
45+
@(deprecated @companionClass)("Use `scala.collection.mutable.HashMap` instead for better performance.", since = "2.13.16")
4446
class AnyRefMap[K <: AnyRef, V] private[collection] (defaultEntry: K => V, initialBufferSize: Int, initBlank: Boolean)
4547
extends AbstractMap[K, V]
4648
with MapOps[K, V, Map, AnyRefMap[K, V]]
@@ -521,6 +523,7 @@ class AnyRefMap[K <: AnyRef, V] private[collection] (defaultEntry: K => V, initi
521523
override protected[this] def stringPrefix = "AnyRefMap"
522524
}
523525

526+
@deprecated("Use `scala.collection.mutable.HashMap` instead for better performance.", since = "2.13.16")
524527
object AnyRefMap {
525528
private final val IndexMask = 0x3FFFFFFF
526529
private final val MissingBit = 0x80000000

0 commit comments

Comments
 (0)