Skip to content

Commit 75e2536

Browse files
committed
Merge '0.6.x' into 'master'.
2 parents 5c50ed9 + fc41c3a commit 75e2536

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

javalib/src/main/scala/java/util/IdentityHashMap.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ import scala.annotation.tailrec
1818

1919
import ScalaOps._
2020

21-
class IdentityHashMap[K, V](inner: HashMap[IdentityHashMap.IdentityBox[K], V])
21+
/* The additional `internal` parameter works around
22+
* https://github.com/scala/bug/issues/11755
23+
*/
24+
class IdentityHashMap[K, V] private (
25+
inner: HashMap[IdentityHashMap.IdentityBox[K], V], internal: Boolean)
2226
extends AbstractMap[K, V] with Map[K, V] with Serializable with Cloneable {
2327
self =>
2428

2529
import IdentityHashMap._
2630

2731
def this(expectedMaxSize: Int) = {
2832
this(new HashMap[IdentityHashMap.IdentityBox[K], V](
29-
expectedMaxSize, HashMap.DEFAULT_LOAD_FACTOR))
33+
expectedMaxSize, HashMap.DEFAULT_LOAD_FACTOR), internal = true)
3034
}
3135

3236
def this() =
@@ -41,7 +45,7 @@ class IdentityHashMap[K, V](inner: HashMap[IdentityHashMap.IdentityBox[K], V])
4145

4246
override def clone(): AnyRef = {
4347
new IdentityHashMap(
44-
inner.clone().asInstanceOf[HashMap[IdentityBox[K], V]])
48+
inner.clone().asInstanceOf[HashMap[IdentityBox[K], V]], internal = true)
4549
}
4650

4751
override def containsKey(key: Any): Boolean =

0 commit comments

Comments
 (0)