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

JPMS Support #749

Open
Mechite opened this issue Jul 21, 2023 · 0 comments
Open

JPMS Support #749

Mechite opened this issue Jul 21, 2023 · 0 comments

Comments

@Mechite
Copy link

Mechite commented Jul 21, 2023

Unsure about the actual msgpack-java library, but the jackson-dataformat-msgpack does not support JPMS properly.

Motivation

JPMS is used by the vast majority of publically released libraries. The performance benefits it provides over the generic classpath, and better compile-time verification is very important. Without native support for JPMS, nobody can release a public library using JPMS and msgpack-java safely.

Changes to be made

There are two options that can be considered in order to get proper compatibility:

  1. The Automatic-Module-Name header in MANIFEST.MF can be set to something suitable, such as org.msgpack.core/org.msgpack.jackson. This maintains compatibility with Java versions before JPMS, such as Java 8.
  2. Making a module-info file and making the project use JPMS. This has stronger encapsulation and is the more future-proof method. The issue with this is that you will need Java 9 or above to build the module-info file. There are ways around this:
    • Build the module-info with Java 9 (or Java 11, the following LTS, as most people do) seperately, and build the rest of the project with Java 8.
    • Build the whole project with Java 9/11 and break compatibility with Java 8 entirely (the better option at the end of the day).

Option 1 is the easiest, fastest way to solve the issue.

In any case, the reason this needs to be solved is that nobody can use this library in their libraries otherwise, as it is not safe to publish an artifact that depends on the filename of the module. In this case, as the JAR file is published as jackson-dataformat-msgpack-0.9.3.jar, Java (and Maven/most build tools) automatically resolves it as the module jackson.dataformat.msgpack.
If somebody were to rename the JAR file and add it to their module path, it would not work, and if the project was updated to support JPMS, it would not work anymore, so people using a library previously using this filename based link would have to add this old version to the module path too in order to keep compatibility.

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

1 participant