@@ -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 ],
@@ -170,17 +176,18 @@ trait SetFromMapOps[
170
176
override def view : View [A ] = underlying.keySet.view
171
177
}
172
178
173
- object SetFromMapOps {
179
+ private object SetFromMapOps {
174
180
175
181
// top type to make pattern matching easier
176
182
sealed trait WrappedMap [A ] extends IterableOnce [A ] {
177
183
protected [collection] val underlying : IterableOnce [(A , Unit )]
178
184
}
179
185
180
- trait DynamicClassName { self : Iterable [_] =>
186
+ trait DynamicClassName {
187
+ self : Iterable [_] =>
181
188
protected [collection] val underlying : Iterable [_]
182
189
183
- override protected [this ] def className : String = s " SetFrom_ ${underlying.collectionClassName}"
190
+ override protected [this ] def className : String = s " SetFrom_ ${ underlying.collectionClassName }"
184
191
}
185
192
186
193
// unknown whether mutable or immutable
@@ -281,7 +288,7 @@ object SetFromMapOps {
281
288
282
289
}
283
290
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 ])
285
292
extends IterableFactory [CC ]
286
293
with Serializable {
287
294
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]
317
324
318
325
}
319
326
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 ])
321
328
extends SortedIterableFactory [CC ]
322
329
with Serializable {
323
330
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
353
360
354
361
}
355
362
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 ]] {
357
364
def apply [A ](map : MM [A , Unit ]): CC [A ]
358
365
}
359
366
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 ]]
361
368
extends SetFromMapMetaFactoryBase [MM , CC ] {
362
369
def apply (factory : MapFactory [MM ]): IterableFactory [CC ]
363
370
}
364
371
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 ]]
366
373
extends SetFromMapMetaFactoryBase [MM , CC ] {
367
374
def apply (factory : SortedMapFactory [MM ]): SortedIterableFactory [CC ]
368
375
}
0 commit comments