-
Notifications
You must be signed in to change notification settings - Fork 31
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
Afterburner (or Blackbird) with jackson-jr? #47
Comments
@Macarse I have toyed with the idea as I don't think that is a bad idea at all. I think that should be an optional add-on, similar to how it works with regular Jackson; partly because there is still some additional risk of failures (since it's more elaborate setup with bytecode generation etc), and partly because it just won't work on Android. I have not worked on anything like this, but I think idea itself is valid and I would love to help if anyone wants to prototype the idea. |
@cowtowncoder afterburner + databind doesn't work on Android? |
Correct: Android bytecode is not Java bytecode but its own thing, and may or may not be dynamically loadable. If it is, then different support library (Afterburner uses Some of techniques that Afterburner uses would actually work (specifically, use of |
@cowtowncoder I am interested in Android. Inside their repo they have a comparison of a couple of libraries but jackson-jr is not there. So I wanted to give it a try. I have tried replacing Jackson with Jackson-Jr in my personal branch: Is there a way to see logs? |
@Macarse logs of... ? Neither Jackson nor jackson-jr logs anything FWIW LoganSquare does use streaming parer/generator from Still would be interesting to see |
@cowtowncoder oh interesting. How do you usually figure out what's wrong? The code is serializing with:
Logs show that the String output is: |
@Macarse what is the class like? It would first sound like there were no public getters available on that object -- jackson-jr versions before 2.8.0 required getters. It is also not an error if no properties are found (unlike default settings with Jackson). |
@cowtowncoder wait, what? I am using jackson-jr in my work project and I am using it without getters and setters. Just public fields. |
@cowtowncoder ok, I am clueless. Adding getters and setters fixed the LoganSquare Demo. I will update my code. How come my model works without getters and setters? |
Cool. So, on fields -- version 2.8.0 DOES support use of simple public fields. Older versions (up 2.7) do NOT. So it depends on version. Support for fields was added since Android developers mentioned that there are reasons for wanting to avoid use of fields. Interesting numbers; clearly Moshi has been geared at Android use as its numbers are better than GSON here, which is different from J2SE where GSON seems to be faster. |
I found my issue, after cleaning the build my code stop working. Apparently I started using 2.8 and changed it to 2.7.x but the dependency was not updated. @cowtowncoder do you maintain a changelog? I can't find any doc which says 2.8 supports fields and 2.7 does not. I would also like to know if 2.8.1 is prod ready. |
Yes, changelog is under https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8 list this change (although list of all changes is sometimes incomplete; modules keep actual changes in 2.8.1 is now released. |
@cowtowncoder thanks. since I am only going to use |
@Macarse yes, you may want to do that; if it's left on, getter/setter is used instead of field if one exists, otherwise field is used. So if you never plan on using getters, turn them off; ditto for setters. |
What would be required to add Afterburner style support? Can this still be evaluated? |
@hc-codersatlas If anyone wants to implement it, I'd be happy to help. I do not have any extra time to work on this personally. But then again, mr-bean came as external contribution, and then served as basis of Afterburner. But basically |
As far as I understand afterburner can't be used with jackson-jr.
Is there any plan to "port" afterburner?
The text was updated successfully, but these errors were encountered: