Skip to content

Commit

Permalink
Update to Scala 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Z1kkurat committed May 8, 2024
1 parent 482a801 commit 9072f70
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
with:
type: ${{ job.status }}
job_name: Build
url: ${{ secrets.SLACK_WEBHOOK }}
url: ${{ secrets.SLACK_WEBHOOK }}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import play.api.libs.json._
*/
object FlatTypeFormat:
def apply[A](using reads: FlatTypeReads[A], writes: FlatTypeWrites[A]): OFormat[A] =
OFormat(reads reads _, writes writes _)
OFormat(reads.reads(_), writes.writes(_))
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import play.api.libs.json.OFormat

object NestedTypeFormat:
def apply[A](using reads: NestedTypeReads[A], writes: NestedTypeWrites[A]): OFormat[A] =
OFormat(reads reads _, writes writes _)
OFormat(reads.reads(_), writes.writes(_))
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.util.control.NonFatal
* It is an internal implementation for [[com.evolution.playjson.jsoniter.PlayJsonJsoniter]]
*/
object Formats {
private[this] val pool = new ThreadLocal[(Array[Byte], JsonReader, JsonWriter)] {
private[Formats] val pool = new ThreadLocal[(Array[Byte], JsonReader, JsonWriter)] {
override def initialValue(): (Array[Byte], JsonReader, JsonWriter) = {
val buf = new Array[Byte](128)
(buf, new JsonReader(buf, charBuf = new Array[Char](128)), new JsonWriter(buf))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ object PlayJsonHelper {

def reads(json: JsValue): JsResult[Instant] = {
def readStr = for {x <- json.validate[String]} yield {
val temporal = Try { Format parse x } recover { case _: DateTimeParseException => IsoFormat parse x }
Instant from temporal.get
val temporal = Try { Format.parse(x) } recover { case _: DateTimeParseException => IsoFormat.parse(x) }
Instant.from(temporal.get)
}

def readNum = for {x <- json.validate[Long]} yield Instant.ofEpochMilli(x)

readStr orElse readNum
}

def writes(o: Instant): JsValue = JsString(Format format o)
def writes(o: Instant): JsValue = JsString(Format.format(o))
}


Expand All @@ -71,7 +71,7 @@ object PlayJsonHelper {
} yield LocalTime.parse(time, Format)
}

def writes(o: LocalTime): JsValue = JsString(Format format o)
def writes(o: LocalTime): JsValue = JsString(Format.format(o))
}


Expand Down

0 comments on commit 9072f70

Please sign in to comment.