From 4b8d41ac7818dd7d06a0a496307066a7249ed0ed Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 29 May 2019 08:30:06 +0200 Subject: [PATCH] Adapt to 2.13.0-RC3 --- .travis.yml | 2 +- build.sbt | 2 +- .../compat/java8/ScalaStreamSupport.java | 2 +- .../scala/compat/java8/StreamConverters.scala | 26 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24e00c5..a90acc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ jdk: - openjdk11 scala: - - 2.13.0-RC2 + - 2.13.0-RC3 env: global: diff --git a/build.sbt b/build.sbt index 5cb40dd..fa8337f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := List("2.13.0-RC2") +crossScalaVersions in ThisBuild := List("2.13.0-RC3") val disableDocs = sys.props("nodocs") == "true" || diff --git a/src/main/java/scala/compat/java8/ScalaStreamSupport.java b/src/main/java/scala/compat/java8/ScalaStreamSupport.java index c1ac69b..af78ecd 100644 --- a/src/main/java/scala/compat/java8/ScalaStreamSupport.java +++ b/src/main/java/scala/compat/java8/ScalaStreamSupport.java @@ -71,7 +71,7 @@ public static Stream streamKeys(Map coll) { * @return A Stream view of the collection which, by default, executes sequentially. */ public static Stream streamValues(Map coll) { - return StreamSupport.stream(coll.>valueStepper(StepperShape.anyStepperShape()).spliterator(), false); + return StreamSupport.stream(coll.>valueStepper(StepperShape.anyStepperShape()).spliterator(), false); } /** diff --git a/src/main/scala/scala/compat/java8/StreamConverters.scala b/src/main/scala/scala/compat/java8/StreamConverters.scala index 237a853..7234e7a 100644 --- a/src/main/scala/scala/compat/java8/StreamConverters.scala +++ b/src/main/scala/scala/compat/java8/StreamConverters.scala @@ -41,12 +41,12 @@ trait StreamExtensions { s.fromStepper(cc.stepper, par = false) } - protected type IterableOnceWithEfficientStepper[A] = IterableOnce[A] { - def stepper[B >: A, S <: Stepper[_]](implicit shape : StepperShape[B, S]) : S with EfficientSplit - } - // Not `CC[X] <: IterableOnce[X]`, but `C` with an extra constraint, to support non-parametric classes like IntAccumulator implicit class IterableNonGenericHasParStream[A, C <: IterableOnce[_]](c: C)(implicit ev: C <:< IterableOnce[A]) { + private type IterableOnceWithEfficientStepper = IterableOnce[A] { + def stepper[S <: Stepper[_]](implicit shape : StepperShape[A, S]) : S with EfficientSplit + } + /** Create a parallel [[java.util.stream.Stream Java Stream]] for this collection. If the * collection contains primitive values, a corresponding specialized Stream is returned (e.g., * [[java.util.stream.IntStream `IntStream`]]). @@ -55,13 +55,13 @@ trait StreamExtensions { s: StreamShape[A, S, St], st: StepperShape[A, St], @implicitNotFound("`parStream` can only be called on collections where `stepper` returns a `Stepper with EfficientSplit`") - isEfficient: C <:< IterableOnceWithEfficientStepper[A]): S = + isEfficient: C <:< IterableOnceWithEfficientStepper): S = s.fromStepper(ev(c).stepper, par = true) } // maps - implicit class MapHasSeqKeyValueStream[K, V, CC[X, Y] <: collection.MapOps[X, Y, CC, _]](cc: CC[K, V]) { + implicit class MapHasSeqKeyValueStream[K, V, CC[X, Y] <: collection.MapOps[X, Y, collection.Map, _]](cc: CC[K, V]) { /** Create a sequential [[java.util.stream.Stream Java Stream]] for the keys of this map. If * the keys are primitive values, a corresponding specialized Stream is returned (e.g., * [[java.util.stream.IntStream `IntStream`]]). @@ -85,10 +85,10 @@ trait StreamExtensions { } - implicit class MapHasParKeyValueStream[K, V, CC[X, Y] <: collection.MapOps[X, Y, CC, _]](cc: CC[K, V]) { - private type MapOpsWithEfficientKeyStepper[K, V] = collection.MapOps[K, V, CC, _] { def keyStepper[S <: Stepper[_]](implicit shape : StepperShape[K, S]) : S with EfficientSplit } - private type MapOpsWithEfficientValueStepper[K, V] = collection.MapOps[K, V, CC, _] { def valueStepper[V1 >: V, S <: Stepper[_]](implicit shape : StepperShape[V1, S]) : S with EfficientSplit } - private type MapOpsWithEfficientStepper[K, V] = collection.MapOps[K, V, CC, _] { def stepper[B >: (K, V), S <: Stepper[_]](implicit shape : StepperShape[B, S]) : S with EfficientSplit } + implicit class MapHasParKeyValueStream[K, V, CC[X, Y] <: collection.MapOps[X, Y, collection.Map, _]](cc: CC[K, V]) { + private type MapOpsWithEfficientKeyStepper = collection.MapOps[K, V, collection.Map, _] { def keyStepper[S <: Stepper[_]](implicit shape : StepperShape[K, S]) : S with EfficientSplit } + private type MapOpsWithEfficientValueStepper = collection.MapOps[K, V, collection.Map, _] { def valueStepper[V1 >: V, S <: Stepper[_]](implicit shape : StepperShape[V1, S]) : S with EfficientSplit } + private type MapOpsWithEfficientStepper = collection.MapOps[K, V, collection.Map, _] { def stepper[S <: Stepper[_]](implicit shape : StepperShape[(K, V), S]) : S with EfficientSplit } /** Create a parallel [[java.util.stream.Stream Java Stream]] for the keys of this map. If * the keys are primitive values, a corresponding specialized Stream is returned (e.g., @@ -98,7 +98,7 @@ trait StreamExtensions { s: StreamShape[K, S, St], st: StepperShape[K, St], @implicitNotFound("parKeyStream can only be called on maps where `keyStepper` returns a `Stepper with EfficientSplit`") - isEfficient: CC[K, V] <:< MapOpsWithEfficientKeyStepper[K, V]): S = + isEfficient: CC[K, V] <:< MapOpsWithEfficientKeyStepper): S = s.fromStepper(cc.keyStepper, par = true) /** Create a parallel [[java.util.stream.Stream Java Stream]] for the values of this map. If @@ -109,7 +109,7 @@ trait StreamExtensions { s: StreamShape[V, S, St], st: StepperShape[V, St], @implicitNotFound("parValueStream can only be called on maps where `valueStepper` returns a `Stepper with EfficientSplit`") - isEfficient: CC[K, V] <:< MapOpsWithEfficientValueStepper[K, V]): S = + isEfficient: CC[K, V] <:< MapOpsWithEfficientValueStepper): S = s.fromStepper(cc.valueStepper, par = true) // The parStream extension method for IterableOnce doesn't apply because its `CC` takes a single type parameter, whereas the one here takes two @@ -120,7 +120,7 @@ trait StreamExtensions { s: StreamShape[(K, V), S, St], st: StepperShape[(K, V), St], @implicitNotFound("parStream can only be called on maps where `stepper` returns a `Stepper with EfficientSplit`") - isEfficient: CC[K, V] <:< MapOpsWithEfficientStepper[K, V]): S = + isEfficient: CC[K, V] <:< MapOpsWithEfficientStepper): S = s.fromStepper(cc.stepper, par = true) }