Skip to content

Modularization #160

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

Closed
Miha-x64 opened this issue Mar 1, 2018 · 9 comments
Closed

Modularization #160

Miha-x64 opened this issue Mar 1, 2018 · 9 comments

Comments

@Miha-x64
Copy link
Contributor

Miha-x64 commented Mar 1, 2018

Hello.
I'm currently working on a library for Android which requires JSON parsing.
My requirements are:
— small methods count (DEX limit);
— small bytecode size (smaller APK and faster verification);
— high parsing speed.

I totally like your parser. I've took your streaming code, removed <T> parsing, Any type, and some other unused stuff; inlined one-liners.
My result is <50 methods and 10.8 KB DEX :)

I think it makes sense to move streaming to another module/artifact so those who need only streaming may use it without other parser parts.

@taowen
Copy link
Contributor

taowen commented Mar 2, 2018

I would like to make this change as well. But I do not have time to work on this at the moment. If you want to contribute, just go ahead.

@Miha-x64
Copy link
Contributor Author

Miha-x64 commented Mar 2, 2018

If this will break existing API, will you accept such changes?
For example, I may introduce streaming.JsonIterator, ast.JsonTree, databind.JsonBind, and, probably, jpath.JsonPath for #89.

@taowen
Copy link
Contributor

taowen commented Mar 2, 2018

We can start a V2 version.

@Miha-x64
Copy link
Contributor Author

Miha-x64 commented Mar 3, 2018

Ok.
The main idea is to move the core (streaming parser) into its own module, make it very small (merge some classes, inline methods, etc), and make full-featured parser with Any and binding support depend on the core.
I'd also removed base64 copy-paste and added dependency on https://github.com/koron/MiGBase64.

@jpe42
Copy link

jpe42 commented Mar 3, 2018

Any chance of bumping the version to Java 9 along with this change to support jigsaw modularity as well? I maintain a JDK 10 targeted fork of jsoniter with a module-info.java specified so that I can use this as part of a jlink build.

@Miha-x64
Copy link
Contributor Author

Miha-x64 commented Mar 3, 2018

Any way to add module-info without breaking Java 6 compatibility?
I haven't ever written code with source = 9 and target = 1.6 :)

@jpe42
Copy link

jpe42 commented Mar 3, 2018

No, I don't think it is possible. I only mentioned it because this would be a new version bump so I was hoping it might be a good opportunity to move forward. Also, forgot to mention, Java 9 has a supplied Base64 Encoder.

@Miha-x64
Copy link
Contributor Author

Miha-x64 commented Mar 3, 2018

Sadly, Android requires 1.6 bytecode, and this parser is very helpful there since org.json, embedded in Android, totally sucks.

You can just add module-info into your JAR.

@taowen
Copy link
Contributor

taowen commented Mar 5, 2018

@Miha-x64 https://github.com/json-iterator/java-core invited you to host the development

@Miha-x64 Miha-x64 closed this as completed Mar 5, 2018
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