-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Sealed hierarchy of case classes serialization won't work #289
Comments
Can you provide a more thorough example of your case class structure? I'm not understanding why it doesn't work without custom serializers/deserializers in the first place. The case class serializer is found very early in the class hierarchy. When it later stumbles upon your custom serializer it uses that since it appears more specific than the generic case class one it found earlier. |
EDIT
When
because otherwise it will be impossible to deserialize it properly. I looked into code and found that jackson is unable to handle this situation.
Because in this situation we do not need to serialize type information. And jackson doesn't store context in which class is used, so "there is no hope for us". |
Have you approached this problem using |
I tried but
compilation failed
|
|
Yes. It will solve the problem, but I thing they are discouraged for a reason (unknown for me), so I just created custom serializer and deserializer for sealed trait. |
The plan has always been to add "real" scala support in scala 2.12 once we had access to a real scala reflection API. Now that it's available no one has really had much time to make it happen. As of right now, though, this is just not possible yet. |
Sealed hierarchy of case classes are widely used in Scala, however in Jackson-Scala they don't seem to be supported.
We are looking for a workaround: when we try to add custom serializers / deserializers for our sealed trait and then use the default "serializers" for the subclasses, the serializers/deserializers for the trait take higher priority and this results in a Stackoverflow error.
Is there a solution for this?
The text was updated successfully, but these errors were encountered: