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

Add support for JPMS modules #44

Open
mtf90 opened this issue Dec 12, 2023 · 0 comments
Open

Add support for JPMS modules #44

mtf90 opened this issue Dec 12, 2023 · 0 comments

Comments

@mtf90
Copy link

mtf90 commented Dec 12, 2023

Is there any interest in supporting JPMS modules introduced in Java 9? Currently, I am in the process of modularizing some projects and get a warning when using BRICS since the compiler is only able to infer a filename-based module name. I see two possibilities to address this issue.

  1. The least invasive approach would be to include an Automatic-Module-Name entry in the MANIFEST.MF file of the built JAR file. This would allow you to claim a module name (something like dk.brics.automaton) and get rid of the warnings without having to change too much of the build process. For example (in case of Maven), it would only require an additional config property on the jar-plugin.

  2. However, since BRICS barely has any dependencies, it would also be easy to add a full module-info.java descriptor which would allow people to conveniently use BRICS in more advanced setups that include jlink or jpackage. The drawback of this approach is that you would have to build BRICS on a JDK greater than 8. To not break compatibility with the current version, I would suggest to realize this with two compilation phases. One that compiles everything for Java 9+ (including the module-info) and one that re-compiles everything (except the module-info) for Java 8. Since module-info isn't a valid Java identifier, you can't reference this file in regular Java 8 applications. So unless you are doing some reflective JAR scanning, people shouldn't run into any problems with UnsupportedClassVersionErrors.

If interested, I could provide a PR for the initial support of this feature. However, since I am not really well-versed in Ant, I would probably need some help to adjust the build.xml as well.

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