-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add a module-info #40
base: master
Are you sure you want to change the base?
Conversation
@generalmimon Is there anything I can do to help you get around to this? I will send you a pizza. |
Bump |
@bowbahdoe I think the idea is good, the implementation looks probably fine. I'm just curious if My other remark is that if #39 becomes a functionality that someone (i.e. you) depend on, we should test in CI whether it actually fulfills the purpose you proposed in #39 (i.e. if Otherwise, the module info generation performed by
|
Yeah so using the moditect-maven-plugin is akin to having the compiler not check import statements and just asserting them via a config file separately. This is not ideal and you generally would want the compiler to check it for you. Its just a compromise to not have to upgrade past Java 8. If that taboo is broken then yeah - putting a Which, honestly, compiling for java 7 is already annoying. If i try to compile the project with a recent JDK I get
I can loop back to this and figure out the proper CI checks soon otherwise. |
That's what I didn't know: if Actually, could you check whether there are any upsides/downsides of doing what https://aseovic.medium.com/building-java-8-compatible-modular-jars-715b04299a7c or https://medium.com/nipafx-news/incremental-modularization-modular-jars-on-java-9-and-auto-updates-1176cd3a84d6#5709 suggest? The first article claims that it's possible to do what we want without multi-release JARs and that they are overkill for this purpose:
It's an article from 2018, so the tooling issues might have disappeared since then, but this approach still seems worth at least considering. I personally don't know what's wrong with multi-release JARs (or if this criticism still applies in 2024), but if there's a simpler option that will work just fine, then why not use it. Simpler things usually work reliably and break less often. Either way, I think that not only will we want to test in CI whether the You can use https://github.com/generalmimon/ks-java-runtime-test/blob/8e94a91e215bd8e4c41d9b29e2be37245d944a12/.github/workflows/maven.yml as an inspiration of what building the JAR and then testing it on different versions of Java can look like. It can probably be simpler, because we don't have to support building the JAR on JDK 8 anymore (I assume that it won't be possible to build the modular JAR using JDK 8 anyway, but that's fine). We can only build on one fixed JDK version (at the moment it probably makes the most sense to use JDK 17), but we should verify that the JAR we build this way can run everywhere. On the topic of dropping support for old Java versions: I don't think we want to drop support for Java 8 right now. Java 8 has not reached end of life yet: Oracle provides Extended Support for Java 8 until the end of 2030, Azul Zulu will support Java 8 until 2030 too, Eclipse Temurin will continue to offer Java 8 until 2026, etc. And https://www.java.com/en/download/ still offers Java 8. Therefore, I assume there is still a significant use of Java 8 in production, so it makes no sense to drop its support.
Dropping Java 7 is probably OK - unlike Java 8, Java 7 seems to be essentially dead now. Here's a graph from https://newrelic.com/resources/report/2024-state-of-the-java-ecosystem: We can notice that the use of Java 8 is on the decline, but it's still used pretty much as heavily as Java 11 or Java 17. In contrast, the use of Java 7 seems to be negligible. |
Surprisingly, my initial intuition that it might be possible to just include the "module info" into the JAR and have Java 8 ignore it but enjoy the benefits of modules in Java 9+ might not be wrong after all. This article claims that you can do exactly that:
The question is whether it's a good idea to do that, considering that this non-standard approach might be a problem for other tools as they point out here. It seems that the multi-release JARs are the standard approach, so perhaps it doesn't make sense to avoid them after all. If we'll test in CI that we can build a multi-release JAR that runs smoothly on Java 8, 11, 17 and 21, then I have no problem with it. |
Addresses #39
Generated module-info looks like this