com-lihaoyi / upickle

uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala
https://com-lihaoyi.github.io/upickle
MIT License
722 stars 165 forks source link

Use primary constructor instead of apply when create case class #637

Closed nox213 closed 1 month ago

nox213 commented 1 month ago

fixes #624

When creating a Reader for a case class with a custom apply method, the process can fail if the apply method returns a different type than the case class itself. To address this, I’ve modified the macro to use the primary constructor instead.

nox213 commented 1 month ago

https://github.com/com-lihaoyi/upickle/pull/607 I wasn't aware of this