You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jsoniter-scala-macros/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMaker.scala
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -924,8 +924,10 @@ object JsonCodecMaker {
924
924
valsymbol= p.asTerm
925
925
valname= decodeName(symbol)
926
926
valannotationOption= annotations.get(name)
927
-
if (annotationOption.exists(_.transient)) None
928
-
else {
927
+
if (annotationOption.exists(_.transient)) {
928
+
if (symbol.isParamWithDefault) None
929
+
else fail(s"Transient field '$name' in class '$tpe' should have default value.")
Copy file name to clipboardExpand all lines: jsoniter-scala-macros/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMaker.scala
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2145,7 +2145,7 @@ private class JsonCodecMakerInstance(cfg: CodecMakerConfig)(using Quotes) {
Copy file name to clipboardExpand all lines: jsoniter-scala-macros/shared/src/test/scala/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMakerSpec.scala
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3252,6 +3252,15 @@ class JsonCodecMakerSpec extends VerifyingSpec {
3252
3252
else"No implicit 'com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec[_ >: scala.Nothing <: scala.Any]' defined for '_root_.java.util.Date'."
3253
3253
})
3254
3254
}
3255
+
"don't generate codecs for classes with transient field without default value" in {
0 commit comments