@@ -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 ],
@@ -170,17 +176,18 @@ trait SetFromMapOps[
170176 override def view : View [A ] = underlying.keySet.view
171177}
172178
173- object SetFromMapOps {
179+ private object SetFromMapOps {
174180
175181 // top type to make pattern matching easier
176182 sealed trait WrappedMap [A ] extends IterableOnce [A ] {
177183 protected [collection] val underlying : IterableOnce [(A , Unit )]
178184 }
179185
180- trait DynamicClassName { self : Iterable [_] =>
186+ trait DynamicClassName {
187+ self : Iterable [_] =>
181188 protected [collection] val underlying : Iterable [_]
182189
183- override protected [this ] def className : String = s " SetFrom_ ${underlying.collectionClassName}"
190+ override protected [this ] def className : String = s " SetFrom_ ${ underlying.collectionClassName }"
184191 }
185192
186193 // unknown whether mutable or immutable
@@ -281,7 +288,7 @@ object SetFromMapOps {
281288
282289}
283290
284- abstract class SetFromMapFactory [+ MM [K , V ] <: Map [K , V ], + CC [A ] <: WrappedMap [A ]](mf : MapFactory [MM ])
291+ private abstract class SetFromMapFactory [+ MM [K , V ] <: Map [K , V ], + CC [A ] <: WrappedMap [A ]](mf : MapFactory [MM ])
285292 extends IterableFactory [CC ]
286293 with Serializable {
287294 protected [this ] def fromMap [A ](map : MM [A , Unit ]): CC [A ]
@@ -317,7 +324,7 @@ abstract class SetFromMapFactory[+MM[K, V] <: Map[K, V], +CC[A] <: WrappedMap[A]
317324
318325}
319326
320- abstract class SortedSetFromMapFactory [+ MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: WrappedMap [A ]](mf : SortedMapFactory [MM ])
327+ private abstract class SortedSetFromMapFactory [+ MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: WrappedMap [A ]](mf : SortedMapFactory [MM ])
321328 extends SortedIterableFactory [CC ]
322329 with Serializable {
323330 protected [this ] def fromMap [A : Ordering ](map : MM [A , Unit ]): CC [A ]
@@ -353,16 +360,16 @@ abstract class SortedSetFromMapFactory[+MM[K, V] <: SortedMap[K, V], +CC[A] <: W
353360
354361}
355362
356- sealed abstract class SetFromMapMetaFactoryBase [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]] {
363+ private sealed abstract class SetFromMapMetaFactoryBase [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]] {
357364 def apply [A ](map : MM [A , Unit ]): CC [A ]
358365}
359366
360- abstract class SetFromMapMetaFactory [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]]
367+ private abstract class SetFromMapMetaFactory [MM [K , V ] <: Map [K , V ], + CC [A ] <: Set [A ]]
361368 extends SetFromMapMetaFactoryBase [MM , CC ] {
362369 def apply (factory : MapFactory [MM ]): IterableFactory [CC ]
363370}
364371
365- abstract class SortedSetFromMapMetaFactory [MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: SortedSet [A ]]
372+ private abstract class SortedSetFromMapMetaFactory [MM [K , V ] <: SortedMap [K , V ], + CC [A ] <: SortedSet [A ]]
366373 extends SetFromMapMetaFactoryBase [MM , CC ] {
367374 def apply (factory : SortedMapFactory [MM ]): SortedIterableFactory [CC ]
368375}
0 commit comments