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

Support for fastutil collections #38

Open
leventov opened this issue Dec 12, 2018 · 8 comments
Open

Support for fastutil collections #38

leventov opened this issue Dec 12, 2018 · 8 comments

Comments

@leventov
Copy link

It would be nice to support fastutil collection
The previous discussion: https://markmail.org/message/anwbtpgbvwh4ox4v#query:+page:1+mid:xqwwbpgh2ul46nst+state:results

I could do this by copy pasting https://github.com/FasterXML/jackson-datatypes-collections/tree/master/hppc and some parts from https://github.com/FasterXML/jackson-datatypes-collections/tree/master/eclipse-collections very literally, but maybe it's time to do some refactoring and introduce basic primitive collection serialization types for all primitive collection libraries, which specific libraries could subclass trivially?

@cowtowncoder
Copy link
Member

First of all, +1 for fastutil datatype.

As to shareable code, I am bit ambivalent on that, mostly regarding technical details of how to make it work in a way that does not add fragility.
So, I am +1 for being able to reuse up-to-date components, in itself. But I am bit worried about keeping things in-sync, and not adding to challenges of inter-component dependencies.
I have limited reuse/adoption of base classes from jackson-databind in some cases, to (for example) wait 1 minor version before making datatype use newly added base types (to retain some level of compability between "adjacent" minor releases (that is, making it more likely that some combinations of 'close enough' versions of databind, datatype, still work even if not guaranteed).

So: I think that maybe it could start with clean up of one of collections datatypes, refactoring, creating suggested base types, but not yet extracting these in first version, but cut'n pasting copies (in different packages)? This is how base ReferenceType serializer, deserializer (for Java 8 / Guava / Scala Optional, JDK AtomicReference) was implemented.

Another thing to consider is that alternatively base classes could be formally added in 3.0, since anything 3.x version would start with fresh baseline (i.e. there is no need to worry about backwards compatibility for that one particular version).

Finally, there is of course little bit of base class functionality already in 2.x (AsArraySerializer, ContainerSerializer etc, I think). This could perhaps serve as some sort of basis.

Anyway: I think I would probably start by making new datatype modular, with base classes that would seem like they could work for most other container types (for Guava, HPPC etc). Then see if copying base classes would work: release one minor version with such cut-pasted versions.
And if/when this works, include shared base classes either in jackson-databind (if somewhat limited number of types -- judgment call), or in new shared component.

... come to think of that, if a separate component used, could even consider shading code in, instead of adding dependency. That would alleviate version compatibility concerns, as long as care is taken never to expose those types via API (since they will all be repackaged under different Java packages via shading).

@leventov
Copy link
Author

I was thinking about extracting yet another separate package "jackson-databind-primitive-collections-base", on which hppc, pCollections, eclipse-collections and fastutil could depend, rather than pulling that base classes into jackson-databind itself. Maybe if they are in a separate package, compatibility standard could be eased a bit.

@cowtowncoder
Copy link
Member

That works, either as separate artifact, or by maybe shading common parts (I think having single source gets most of benefits) into artifacts.

@ghost
Copy link

ghost commented Mar 26, 2020

It's this going to be added? up

@leventov
Copy link
Author

@NycuRO I'm not working on this anymore

@ghost
Copy link

ghost commented Mar 28, 2020

@cowtowncoder ?

@yawkat
Copy link
Member

yawkat commented Mar 28, 2020

I don't think anyone is working on this at the moment. The infrastructure is there with primitive-collections-base, but someone would have to implement the fastutil parts. The eclipse-collections module is a good template, so feel free to try your hand

@cowtowncoder
Copy link
Member

@NycuRO I do not have time to work on this.

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

No branches or pull requests

3 participants