-
Notifications
You must be signed in to change notification settings - Fork 25
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 java module system (jpms) via Multi-Release jar with module-info - [was Minimum Java 11...] #53
Comments
I'm curious to understand why you're considering making it require a minimum of Java11? |
In theory:
In reality I'm not sure if this is a great idea yet. I don't know when libraries should bump up from Java 8 but I think we will have to do it at some point so when ... (personally and for the places I work they are all Java 11+). Hmmm. |
From what is an admittedly selfish desire, I would prefer to see that it remain Java8 compatible for now, since we still have several projects that still need to maintain Java8 compatibility unfortunately. For JPMS compatibility, I think it may be possible to use the moditect-maven-plugin to generate the module-info.class file without fulling moving everything to Java9+ (although I've not fully investigated this particular Maven plugin to confirm). It's also not especially difficult to build a multi-release jar in order to add Java9+ features. I've done it for the JSch fork to add support for new crypto algorithms that are available in Java11 & Java15, while keeping the base jar file fully Java8 compatible. It involved adding a few extra execution sequences for maven-compiler-plugin & maven-resources-plugin, and then having the maven-jar-plugin add the multi-release attribute to the manifest. But I understand if you want to avoid adding these sorts of complexities and decide to move to purely requiring Java11+. |
PR for JPMS compatibility via moditech-maven-plugin ... #59 |
For myself with JPMS we need to explicitly register the BeanContextFactory (which is kind of nice) with a provides clause like: module junk {
requires io.avaje.inject;
provides io.avaje.inject.core.BeanContextFactory with org.example._di$Factory;
} ... with jpms developers need to know about and find the BeanContextFactory interface. My gut says it would be nicer if BeanContextFactory was in the Edit: Updated the example module code. |
I think you may be right that it would be better for BeanContextFactory to be in |
There are things in core used by the generated code like BeanLifeCycle, Builder etc. So those need to be in an exported package. I think the options are something like:
Hmmm. |
Hmm, it may be more hassle than it's worth to move BeanContextFactory now that I look more closely. |
I think the same. I'm probably leaning toward renaming |
I think that sounds good to me. |
* #51 Add jpms module-info using Multi-Release jar * #53 - Improve error message for JPMS use and no modules. * #53 - Make javax.inject and org.slf4j transitive. Fix associated readme example. * #53 - Add explicit requires javax.inject to avaje-inject-generator * #53 - Tidy avaje-inject-generator module-info, remove javax.inject as brought in transitively
Ok, lets call this bit done :) |
Originally this was:
Minimum Java 11 - make avaje-inject Java 11+ (from Java 8+)
The text was updated successfully, but these errors were encountered: