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
SchemaFor/Encoder/Decoder implicits not resolved when using case classes with a default value #553
Comments
Interesting; without having looked into it, I would expect issue to be in Magnolia's typeclass derivation logic. Have you tried to have some typeclass derived by pure Magnolia for your class? |
I had the same feeling it could be caused by Magnolia, but I don't understand very well Magnolia, so I were not able to do tests with it. You prefer I open a ticket on Magnolia? |
I was just wondering whether you already experimented with reproducing it with Magnolia. One other thing that I find actually intriguing is how the Scala compiler navigates the constructors in the non-working example, as there are now two zero-arg constructors. I guess the explicit constructor wins over the constructor with default argument... |
I just wrote a new snippet to test Magnolia only and it appears the bug does not happen with 0.17.0 version, Avro4s is using 0.16.0 right now. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@andreas-schroeder Any plan to update Magnolia to 0.17 in a near future? |
I've heard from @SethTisue that Avro4s is using the older version of Magnolia due to a bug, though I can't find any more details on that. But there's a further motivation for upgrading which is that it's blocking a few things in the Scala Community Build. Notwithstanding this issue, I may be able to offer some help here, if we need a new version of Magnoila published to maintain support for Avro4s. |
I don't remember what happened exactly, but perhaps there isn't any "bug", it might simply be that upgrading to newer Magnolia required making some source adjustments that I chose not to tackle |
I've upgraded avro4s to use magnolia 0.17 and released this as avro4s 4.0.3. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Now works on 4.0.3+ https://scastie.scala-lang.org/UIQVRzPQQfGLlV7YA2kz3g |
When a case class have a field with a default value and a
this
constructor which sets field default value, this is how avrohugger generates case class implementing SpecificRecord API, compilation fail and output this:Here is a snippet which reproduce the bug: https://scastie.scala-lang.org/mdQzDpRCQka2FnH80tDOSg
The bug happen under Scala 2.13.3 with latest version of avro4s and avrohugger.
But it appears to be a regression since it works until avro4s 3.0.9 and get broken from 3.1.0.
Thanks.
The text was updated successfully, but these errors were encountered: