Skip to content

Commit

Permalink
Remove redundant lazy in case class decoders (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk authored Jan 23, 2025
1 parent 8d140c3 commit f3f8c9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions zio-json/shared/src/main/scala-2.x/zio/json/macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ object DeriveJsonDecoder {
}
(names, aliases)
}
private[this] val len = names.length
private[this] val matrix = new StringMatrix(names, aliases)
private[this] val spans = names.map(JsonError.ObjectAccess)
private[this] lazy val defaults = ctx.parameters.map(_.evaluateDefault).toArray
private[this] val len = names.length
private[this] val matrix = new StringMatrix(names, aliases)
private[this] val spans = names.map(JsonError.ObjectAccess)
private[this] val defaults = ctx.parameters.map(_.evaluateDefault).toArray
private[this] lazy val tcs =
ctx.parameters.map(_.typeclass).toArray.asInstanceOf[Array[JsonDecoder[Any]]]
private[this] lazy val namesMap = (names.zipWithIndex ++ aliases).toMap
Expand Down
2 changes: 1 addition & 1 deletion zio-json/shared/src/main/scala-3/zio/json/macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ sealed class JsonDecoderDerivation(config: JsonCodecConfiguration) extends Deriv
private val len = names.length
private val matrix = new StringMatrix(names, aliases)
private val spans = names.map(JsonError.ObjectAccess(_))
private lazy val defaults = IArray.genericWrapArray(ctx.params.map(_.evaluateDefault)).toArray
private val defaults = IArray.genericWrapArray(ctx.params.map(_.evaluateDefault)).toArray
private lazy val tcs =
IArray.genericWrapArray(ctx.params.map(_.typeclass)).toArray.asInstanceOf[Array[JsonDecoder[Any]]]
private lazy val namesMap = (names.zipWithIndex ++ aliases).toMap
Expand Down

0 comments on commit f3f8c9f

Please sign in to comment.