Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant lazy in case class decoders #1238

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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