-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace scala-collection-compat with ScalaCollectionCompat (#230)
* Cleanup imports in Reads.scala * Replace scala-collection-compat with ScalaCollectionCompat
- Loading branch information
1 parent
b89d0ce
commit 5b04b89
Showing
4 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
play-json/shared/src/main/scala-2.13+/play/api/libs/json/ScalaCollectionCompat.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package play.api.libs.json | ||
|
||
/** Copied from scala-collection-compat, because its binary API isn't stable. */ | ||
private[json] object ScalaCollectionCompat { | ||
type Factory[-A, +C] = scala.collection.Factory[A, C] | ||
} |
28 changes: 28 additions & 0 deletions
28
play-json/shared/src/main/scala-2.13-/play/api/libs/json/ScalaCollectionCompat.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package play.api.libs.json | ||
|
||
import scala.language.implicitConversions | ||
import scala.language.higherKinds | ||
|
||
import scala.collection.generic.CanBuildFrom | ||
import scala.collection.mutable | ||
|
||
/** Copied from scala-collection-compat, because its binary API isn't stable. */ | ||
private[json] object ScalaCollectionCompat { | ||
|
||
/** | ||
* A factory that builds a collection of type `C` with elements of type `A`. | ||
* | ||
* Type param `A` is the type of elements (e.g. `Int`, `Boolean`, etc.). | ||
* Type param `C` is the type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.). | ||
*/ | ||
type Factory[-A, +C] = CanBuildFrom[Nothing, A, C] | ||
|
||
final implicit class FactoryOps[-A, +C](private val factory: Factory[A, C]) { | ||
def newBuilder: mutable.Builder[A, C] = factory() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters