Skip to content
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

Modified to not load the entire Sequence into memory during serialization. #665

Merged
merged 2 commits into from
Apr 15, 2023

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Apr 15, 2023

Fixes #368

Copy link
Member

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM wrt older code. Won't work correctly wrt polymorphic types (old version didn't either), would need bigger changes to handle that, so I think this is a good incremental improvement.

@k163377 k163377 merged commit 4d5f70b into FasterXML:2.15 Apr 15, 2023
@k163377
Copy link
Contributor Author

k163377 commented Apr 15, 2023

@cowtowncoder
Thanks for the review.
Could you please share test cases and any other information that would be helpful?

@k163377 k163377 deleted the fix-#368 branch April 15, 2023 18:05
@cowtowncoder
Copy link
Member

@k163377 if we are taking about missing pieces, I am sure polymorphic Collections are tested in jackson-databind in some places. But the idea is that there'd be something like:

// Java version (modify for Kotlin)
@JsonTypeInfo(....)
public class Base { }

public class Impl extends Base { }

public class Wrapper {
   List<Base> values;

   public Sequence<Base> getValues() { ... }

    @JsonCreator(mode = Mode.DELEGATING)
    public Wrapper(List<Base> values) {
      this.values = values;
    }
}

// and then test will first create and write a `Wrapper`, then
// read it back, to verify polymorphic handling works.

so the only (?) complication is that you can only serialize Sequence (or Iterator etc) so reading back requires real container type.

You could also just verify serialization but I like the idea of round-trip testing that one can write and read back. Use of Wrapper object is to avoid Type Erasure problems.

@k163377
Copy link
Contributor Author

k163377 commented May 3, 2023

Thank you very much.
I have submitted a new isssue.
#671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change the Sequence serializer to not load elements into memory
2 participants