@@ -17,7 +17,13 @@ import scala.annotation.implicitNotFound
1717import scala .collection .SetFromMapOps .WrappedMap
1818import scala .reflect .ClassTag
1919
20- trait SetFromMapOps [
20+ // Implementation note: The `concurrent.Set` implementation
21+ // inherits from this, so we have to be careful about
22+ // making changes that do more than forward to the
23+ // underlying `Map`. If we have a method implementation
24+ // that is not atomic, we MUST override that method in
25+ // `concurrent.SetFromMap`.
26+ private trait SetFromMapOps [
2127 A ,
2228 + MM [K , V ] <: MapOps [K , V , MM , _],
2329 + M <: MapOps [A , Unit , MM , M ],
@@ -189,14 +195,15 @@ trait SetFromMapOps[
189195 override def view : View [A ] = underlying.keySet.view
190196}
191197
192- object SetFromMapOps {
198+ private object SetFromMapOps {
193199
194200 // top type to make pattern matching easier
195201 sealed trait WrappedMap [A ] extends IterableOnce [A ] {
196202 protected [collection] val underlying : IterableOnce [(A , Unit )]
197203 }
198204
199- trait DynamicClassName { self : Iterable [_] =>
205+ trait DynamicClassName {
206+ self : Iterable [_] =>
200207 protected [collection] val underlying : Iterable [_]
201208
202209 override protected [this ] def className : String = s " SetFrom_ ${underlying.collectionClassName}"
@@ -302,7 +309,7 @@ object SetFromMapOps {
302309
303310}
304311
305- abstract class SetFromMapFactory [+ MM [K , V ] <: Map [K , V ], + CC [A ] <: WrappedMap [A ]](
312+ private abstract class SetFromMapFactory [+ MM [K , V ] <: Map [K , V ], + CC [A ] <: WrappedMap [A ]](
306313 mf : MapFactory [MM ]
307314) extends IterableFactory [CC ]
308315 with Serializable {
@@ -339,9 +346,10 @@ abstract class SetFromMapFactory[+MM[K, V] <: Map[K, V], +CC[A] <: WrappedMap[A]
339346
340347}
341348
342- abstract class SortedSetFromMapFactory [+ MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: WrappedMap [A ]](
343- mf : SortedMapFactory [MM ]
344- ) extends SortedIterableFactory [CC ]
349+ private abstract class SortedSetFromMapFactory [+ MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: WrappedMap [
350+ A
351+ ]](mf : SortedMapFactory [MM ])
352+ extends SortedIterableFactory [CC ]
345353 with Serializable {
346354 protected [this ] def fromMap [A : Ordering ](map : MM [A , Unit ]): CC [A ]
347355
@@ -376,16 +384,17 @@ abstract class SortedSetFromMapFactory[+MM[K, V] <: SortedMap[K, V], +CC[A] <: W
376384
377385}
378386
379- sealed abstract class SetFromMapMetaFactoryBase [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]] {
387+ private sealed abstract class SetFromMapMetaFactoryBase [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]] {
380388 def apply [A ](map : MM [A , Unit ]): CC [A ]
381389}
382390
383- abstract class SetFromMapMetaFactory [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]]
391+ private abstract class SetFromMapMetaFactory [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]]
384392 extends SetFromMapMetaFactoryBase [MM , CC ] {
385393 def apply (factory : MapFactory [MM ]): IterableFactory [CC ]
386394}
387395
388- abstract class SortedSetFromMapMetaFactory [MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: SortedSet [A ]]
389- extends SetFromMapMetaFactoryBase [MM , CC ] {
396+ private abstract class SortedSetFromMapMetaFactory [MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: SortedSet [
397+ A
398+ ]] extends SetFromMapMetaFactoryBase [MM , CC ] {
390399 def apply (factory : SortedMapFactory [MM ]): SortedIterableFactory [CC ]
391400}
0 commit comments