@@ -17,7 +17,13 @@ import scala.annotation.implicitNotFound
17
17
import scala .collection .SetFromMapOps .WrappedMap
18
18
import scala .reflect .ClassTag
19
19
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 [
21
27
A ,
22
28
+ MM [K , V ] <: MapOps [K , V , MM , _],
23
29
+ M <: MapOps [A , Unit , MM , M ],
@@ -189,14 +195,15 @@ trait SetFromMapOps[
189
195
override def view : View [A ] = underlying.keySet.view
190
196
}
191
197
192
- object SetFromMapOps {
198
+ private object SetFromMapOps {
193
199
194
200
// top type to make pattern matching easier
195
201
sealed trait WrappedMap [A ] extends IterableOnce [A ] {
196
202
protected [collection] val underlying : IterableOnce [(A , Unit )]
197
203
}
198
204
199
- trait DynamicClassName { self : Iterable [_] =>
205
+ trait DynamicClassName {
206
+ self : Iterable [_] =>
200
207
protected [collection] val underlying : Iterable [_]
201
208
202
209
override protected [this ] def className : String = s " SetFrom_ ${underlying.collectionClassName}"
@@ -302,7 +309,7 @@ object SetFromMapOps {
302
309
303
310
}
304
311
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 ]](
306
313
mf : MapFactory [MM ]
307
314
) extends IterableFactory [CC ]
308
315
with Serializable {
@@ -339,9 +346,10 @@ abstract class SetFromMapFactory[+MM[K, V] <: Map[K, V], +CC[A] <: WrappedMap[A]
339
346
340
347
}
341
348
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 ]
345
353
with Serializable {
346
354
protected [this ] def fromMap [A : Ordering ](map : MM [A , Unit ]): CC [A ]
347
355
@@ -376,16 +384,17 @@ abstract class SortedSetFromMapFactory[+MM[K, V] <: SortedMap[K, V], +CC[A] <: W
376
384
377
385
}
378
386
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 ]] {
380
388
def apply [A ](map : MM [A , Unit ]): CC [A ]
381
389
}
382
390
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 ]]
384
392
extends SetFromMapMetaFactoryBase [MM , CC ] {
385
393
def apply (factory : MapFactory [MM ]): IterableFactory [CC ]
386
394
}
387
395
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 ] {
390
399
def apply (factory : SortedMapFactory [MM ]): SortedIterableFactory [CC ]
391
400
}
0 commit comments