diff --git a/play-json-generic/src/test/scala/com/evolution/playjson/generic/NestedTypeFormatSpec.scala b/play-json-generic/src/test/scala/com/evolution/playjson/generic/NestedTypeFormatSpec.scala index 1fd6cff..bbe73b6 100644 --- a/play-json-generic/src/test/scala/com/evolution/playjson/generic/NestedTypeFormatSpec.scala +++ b/play-json-generic/src/test/scala/com/evolution/playjson/generic/NestedTypeFormatSpec.scala @@ -5,7 +5,7 @@ import Message._ class NestedTypeFormatSpec extends JsonFormatSpec { - implicit val messageFormat = { + implicit val messageFormat: OFormat[Message] = { implicit val noopFormat: OFormat[Noop.type] = new OFormat[Noop.type] { def writes(o: Noop.type): JsObject = Json.obj() def reads(json: JsValue): JsResult[Message.Noop.type] = JsSuccess(Message.Noop) diff --git a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonImplicits.scala b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonImplicits.scala index 8d1857a..e2d962d 100644 --- a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonImplicits.scala +++ b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonImplicits.scala @@ -1,14 +1,14 @@ package com.evolution.playjson.jsoniter import com.evolution.playjson.jsoniter.TestDataGenerators.{Address, User} -import play.api.libs.json.Json +import play.api.libs.json.{Json, OWrites, Reads} trait PlayJsonImplicits { - implicit val e = Json.reads[Address] - implicit val f = Json.writes[Address] + implicit val e: Reads[Address] = Json.reads[Address] + implicit val f: OWrites[Address] = Json.writes[Address] - implicit val g = Json.reads[User] - implicit val h = Json.writes[User] + implicit val g: Reads[User] = Json.reads[User] + implicit val h: OWrites[User] = Json.writes[User] } diff --git a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonWithJsoniterBackendSpec.scala b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonWithJsoniterBackendSpec.scala index 2565310..3a9350d 100644 --- a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonWithJsoniterBackendSpec.scala +++ b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/PlayJsonWithJsoniterBackendSpec.scala @@ -14,7 +14,7 @@ object PlayJsonWithJsoniterBackendSpec extends org.scalacheck.Properties("PlayJs implicit def generator: Arbitrary[User] = Arbitrary(genUser) - property("Write using PlayJson -> Read using Jsoniter") = forAll { user: User => + property("Write using PlayJson -> Read using Jsoniter") = forAll { (user: User) => val jsValue = Json.toJson(user) val bts = Json.toBytes(jsValue) val actJsValue = PlayJsonJsoniter.deserialize(bts).map(Json.fromJson[User](_)) @@ -23,7 +23,7 @@ object PlayJsonWithJsoniterBackendSpec extends org.scalacheck.Properties("PlayJs property("Write using PlayJson -> Read using Jsoniter. Batch") = forAll( Gen.containerOfN[Vector, User](Size, genUser), - ) { batch: Vector[User] => + ) { (batch: Vector[User]) => val bools = batch.map { user => val jsValue = Json.toJson(user) val bts = Json.toBytes(jsValue) @@ -36,7 +36,7 @@ object PlayJsonWithJsoniterBackendSpec extends org.scalacheck.Properties("PlayJs property("Write using Jsoniter -> Read using Jsoniter. Batch") = forAll( Gen.containerOfN[Vector, User](Size, genUser), - ) { batch: Vector[User] => + ) { (batch: Vector[User]) => val bools = batch.map { user => val jsValue = Json.toJson(user) val bts = PlayJsonJsoniter.serialize(jsValue) diff --git a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonArraysSpec.scala b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonArraysSpec.scala index 6012488..868ed30 100644 --- a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonArraysSpec.scala +++ b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonArraysSpec.scala @@ -18,7 +18,7 @@ object RandomJsonArraysSpec extends org.scalacheck.Properties("RandomJsonSpec") override def overrideParameters(p: Test.Parameters): Test.Parameters = p.withMinSuccessfulTests(Size) - property("Random json arrays") = forAll { array: value.JsArray => + property("Random json arrays") = forAll { (array: value.JsArray) => val json = array.toString val jsValue = Json.parse(json) val bts = PlayJsonJsoniter.serialize(jsValue) diff --git a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonObjectsSpec.scala b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonObjectsSpec.scala index ee05bf2..7ed55d6 100644 --- a/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonObjectsSpec.scala +++ b/play-json-jsoniter/jvm/src/test/scala-2.13/com/evolution/playjson/jsoniter/RandomJsonObjectsSpec.scala @@ -18,7 +18,7 @@ object RandomJsonObjectsSpec extends org.scalacheck.Properties("RandomJsonObject override def overrideParameters(p: Test.Parameters): Test.Parameters = p.withMinSuccessfulTests(Size) - property("Random json objects") = forAll { obj: value.JsObj => + property("Random json objects") = forAll { (obj: value.JsObj) => val json = obj.toString val jsValue = Json.parse(json) val bts = PlayJsonJsoniter.serialize(jsValue) diff --git a/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJson27xCompat.scala b/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJson27xCompat.scala index 09e3d06..fbfa246 100644 --- a/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJson27xCompat.scala +++ b/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJson27xCompat.scala @@ -10,7 +10,7 @@ object PlayJson27xCompat { implicit def iterableWrites[A, B](implicit ev: B <:< Iterable[A], writes: Writes[A]): Writes[B] = { Writes[B] { as => val builder = mutable.ArrayBuilder.make[JsValue] - as.foreach { a: A => builder += writes.writes(a) } + as.foreach { (a: A) => builder += writes.writes(a) } JsArray(builder.result()) } } diff --git a/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJsonHelper.scala b/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJsonHelper.scala index 6201e48..522f162 100644 --- a/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJsonHelper.scala +++ b/play-json-tools/src/main/scala/com/evolution/playjson/tools/PlayJsonHelper.scala @@ -37,7 +37,7 @@ object PlayJsonHelper { readStr orElse readNum } - def writes(o: FiniteDuration) = JsString(o.toCoarsest.toString) + def writes(o: FiniteDuration): JsString = JsString(o.toCoarsest.toString) } @@ -90,7 +90,7 @@ object PlayJsonHelper { a <- from(a) map { x => JsSuccess(x) } getOrElse JsError(s"No ${ tag.runtimeClass.getName } found for $a") } yield a - def writes(a: A) = JsString(to(a)) + def writes(a: A): JsString = JsString(to(a)) } } } @@ -107,7 +107,7 @@ object PlayJsonHelper { a <- from(a) map { x => JsSuccess(x) } getOrElse JsError(s"No ${ tag.runtimeClass.getName } found for $a") } yield a - def writes(x: A) = JsNumber(to(x)) + def writes(x: A): JsNumber = JsNumber(to(x)) } } } @@ -226,7 +226,7 @@ object PlayJsonHelper { implicit val writesTuple: Writes[(K, V)] = new Writes[(K, V)] { - def writes(kv: (K, V)) = { + def writes(kv: (K, V)): JsObject = { val (k, v) = kv val json = Json.toJson(v) match { case json: JsObject => json @@ -237,7 +237,7 @@ object PlayJsonHelper { } new Writes[Map[K, V]] { - def writes(kvs: Map[K, V]) = { + def writes(kvs: Map[K, V]): JsValue = { Json.toJson(kvs.toList) } } diff --git a/play-json-tools/src/test/scala/com/evolution/playjson/tools/DiscriminatedEitherFormatSpec.scala b/play-json-tools/src/test/scala/com/evolution/playjson/tools/DiscriminatedEitherFormatSpec.scala index 4bb82b8..41a8100 100644 --- a/play-json-tools/src/test/scala/com/evolution/playjson/tools/DiscriminatedEitherFormatSpec.scala +++ b/play-json-tools/src/test/scala/com/evolution/playjson/tools/DiscriminatedEitherFormatSpec.scala @@ -6,7 +6,7 @@ import org.scalatest.matchers.should.Matchers import play.api.libs.json._ class DiscriminatedEitherFormatSpec extends AnyFunSuite with Matchers { - implicit val eitherFormat = DiscriminatedEitherFormat.eitherFormat("L", "R"): OFormat[Either[String, Int]] + implicit val eitherFormat: OFormat[Either[String, Int]] = DiscriminatedEitherFormat.eitherFormat("L", "R"): OFormat[Either[String, Int]] val left: Either[String, Int] = Left("foo") val right: Either[String, Int] = Right(1) val fromEitherJson: JsValue => JsResult[Either[String, Int]] = Json.fromJson[Either[String, Int]](_) diff --git a/play-json-tools/src/test/scala/com/evolution/playjson/tools/TypeFormatSpec.scala b/play-json-tools/src/test/scala/com/evolution/playjson/tools/TypeFormatSpec.scala index ca805e4..bba9577 100644 --- a/play-json-tools/src/test/scala/com/evolution/playjson/tools/TypeFormatSpec.scala +++ b/play-json-tools/src/test/scala/com/evolution/playjson/tools/TypeFormatSpec.scala @@ -11,7 +11,7 @@ class TypeFormatSpec extends AnyFunSuite with Matchers { private val mammalJson = Json.obj("type" -> "Mammal", "legs" -> 4) private val slothJson = Json.obj("type" -> "Sloth") - implicit val animalFormat = new TypeFormat[Animal] { + implicit val animalFormat: TypeFormat[Animal] = new TypeFormat[Animal] { val mammalFormat = Json.format[Mammal] val slothFormat = OFormat.const(Sloth) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9ddaff2..962da05 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,9 +6,9 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") -addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.6") +addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")