-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Objects in tuples are not serialized as ids #443
Comments
This still behaves as described |
@cowtowncoder the ObjectId code seems to work at the SerializationProvider level - so that if the same SerializationProvider instance sees the same class instance twice, then the second instance gets the same id assigned. In the example in the issue description, when Foo is wrapped in a class FooPair, the same SerializationProvider instance serializes all the Foo instances. When Foo is wrapped in a Tuple, we seem to end up with different SerializationProvider instances serializing each Foo instance - so the ids all end up as 1. The Tuple Serializer in jackson-modue-scala looks like this
So it ignores the provider that is passed in and when jgen.writeObject is called, ultimately, a new provider will need to be created. I can't see a way to provide jgen.writeObject with a pre-created provider. Would you have any suggestions? |
This seems to be the fix for the Tuple Serializer:
|
Right, without seeing the original code I would speculate that something is calling different underlying |
Using classes annotated with
JsonIdentityInfo
inside of tuples has a weir behaviourprints
Introducing a specific pair class solves the issue:
prints
The text was updated successfully, but these errors were encountered: