summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/HashMap.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-26 11:38:48 -0700
committerPaul Phillips <paulp@improving.org>2012-09-26 11:41:15 -0700
commit052e9b17e22de317d0dc7d3a66729b825b1eb2da (patch)
tree968f9456c73ee55f4253640da9e14408425cfaa9 /src/library/scala/collection/immutable/HashMap.scala
parent742cb71ec8c8205af032df609088affc12d3e1c5 (diff)
downloadscala-052e9b17e22de317d0dc7d3a66729b825b1eb2da.tar.gz
scala-052e9b17e22de317d0dc7d3a66729b825b1eb2da.tar.bz2
scala-052e9b17e22de317d0dc7d3a66729b825b1eb2da.zip
Don't write public methods with non-public parameters.
If the parameter types of a method have lower visibility than the method itself, then the method cannot be overridden because the parameter types cannot be expressed. This is a confusing and frustrating situation to expose via public API. Such methods should either have access as strong as their parameter types, or be made final.
Diffstat (limited to 'src/library/scala/collection/immutable/HashMap.scala')
-rw-r--r--src/library/scala/collection/immutable/HashMap.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala
index a6e750e7ee..ee41e2aa3c 100644
--- a/src/library/scala/collection/immutable/HashMap.scala
+++ b/src/library/scala/collection/immutable/HashMap.scala
@@ -120,7 +120,7 @@ class HashMap[A, +B] extends AbstractMap[A, B]
*/
object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int {
- private abstract class Merger[A, B] {
+ private[collection] abstract class Merger[A, B] {
def apply(kv1: (A, B), kv2: (A, B)): (A, B)
def invert: Merger[A, B]
}
@@ -197,7 +197,7 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int {
// }
// }
- override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] =
+ private[collection] override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] =
if (hash == this.hash && key == this.key ) {
if (merger eq null) {
if (this.value.asInstanceOf[AnyRef] eq value.asInstanceOf[AnyRef]) this
@@ -238,7 +238,7 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int {
override def get0(key: A, hash: Int, level: Int): Option[B] =
if (hash == this.hash) kvs.get(key) else None
- override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] =
+ private[collection] override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] =
if (hash == this.hash) {
if ((merger eq null) || !kvs.contains(key)) new HashMapCollision1(hash, kvs.updated(key, value))
else new HashMapCollision1(hash, kvs + merger((key, kvs(key)), kv))
@@ -316,7 +316,7 @@ object HashMap extends ImmutableMapFactory[HashMap] with BitOperations.Int {
None
}
- override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] = {
+ private[collection] override def updated0[B1 >: B](key: A, hash: Int, level: Int, value: B1, kv: (A, B1), merger: Merger[A, B1]): HashMap[A, B1] = {
val index = (hash >>> level) & 0x1f
val mask = (1 << index)
val offset = Integer.bitCount(bitmap & (mask-1))