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

Set an automatic module (JPMS) name #184

Merged
merged 1 commit into from
Apr 20, 2024

Conversation

hgschmie
Copy link
Contributor

This allows JPMS modules to depend on this component.

@hgschmie
Copy link
Contributor Author

hgschmie commented Sep 1, 2023

pretty ping?

@mikebell90
Copy link
Contributor

mikebell90 commented Sep 1, 2023 via email

@hgschmie
Copy link
Contributor Author

hgschmie commented Sep 8, 2023

understood. In that case we will deprecate and might drop support for this component when we start moving more aggressively towards JPMS integration as we don't want to rely on a filename based automatic module.

@mikebell90
Copy link
Contributor

whats your basic motivation for pushing JPMS? I ask out of curiosity because I've yet to be really convinced it's useful for apps as opposed to the sdk

@mikebell90
Copy link
Contributor

Also what is "filename based automatic module"? I thought automatic modules simply were a manifest entry like what you provided

@hgschmie
Copy link
Contributor Author

JPMS is a fact of life for JDK post 8 and many of the application servers and framework start to support it. As Jdbi is a library that is used in many contexts, supporting JPMS is useful to them and does not harm anyone that is not using JPMS (the module descriptors are not used if the jars are on the classpath).

JPMS is still a long way out (see https://github.com/jdbi/jdbi/blob/master/JPMS-SUPPORT.md) but we will eventually arrive there and I don't want to be held back by dependencies that don't have at least the very minimum of JPMS support (see below). Java 9 shipped six years ago.

There are two types of JPMS modules: "automatic" and "defined":

The interesting piece is how JPMS arrives at the module name for an automatic module: It checks the manifest to see whether there is an "Automatic-Module-Name" entry. If yes, then this becomes the name of the module.

If that key does not exist, then it falls back to the filename (!) of the jar and uses that as the module name. The problem with this is that this is prone to renaming the jars. Providing the name in the manifest makes the module immune to that.

So the very minimum support that any jar should offer to JPMS over the last six years is to pick out a module name and put it into a key in the jar manifest. This is what this PR does and it ensures that a project depends on it, its module name stays stable.

@mikebell90
Copy link
Contributor

If you could rebase, I'll try to find time to test this. thanks

This allows JPMS modules to depend on this component.
@hgschmie
Copy link
Contributor Author

rebased

@mikebell90 mikebell90 merged commit a24a525 into opentable:master Apr 20, 2024
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.

3 participants