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
Investigate split packages and refactor to avoid any split packages across Grails and GORM for Java 11 #11162
Comments
RESEARCH and SUMMARYI did some research into splity packages in the area of modularization and also did a few example applications to discover what we are working with when it comes to the Java 9 with the JPMS jogsaw project In java 9 there is both a classpath and a module path. The module path enforces the modularization feature where packages are grouped into modules. This allows encapsulation by allowing modules to define exports, requires, uses etc in the module-info.java file. There is also mechanisms for backward compatibility with legacy java jars and code. Any packages that don't use modules are brought into an "unnamed module". This will export all its own and import every other module. For jars, if they are non moduled and placed on the module-path, they become automatic modules with a default derived name. All this is so that pre Java 9 apps can be compatible and transition incrementally to modularization. There is however the fact that when using the modularization feature, a package name can only be used in one named module (meaning split packages will cause an error). The way around this is that you just continue to place JARs in the classpath and compilation and running works as the same as before, which will permit split packages. LINKS
ExamplesI did run few examples and played with how these dependencies work on the module-path vs the classpath. Wrapping up code as jars and placing them on the classpath, even given they have split packages, still works. When you place them on the module-path and you still have split packages, then you get a compile time error. I used these links below to get started: THOUGHTS
Finding split packagesI found a way to find split packages using a gradle plugin. See example project here. https://github.com/niravassar/java-gradle-splitpackage-plugin |
I am looking into how to run this plugin on a grails project to find all the collisions |
Java Project to find split packagesI could not use a grails app to find split packages. So i created a gradle java app and dumped all the dist jars from grails in there and generated the split package errors. https://github.com/niravassar/java-splitpackage-grails-jars I will upload the results here |
Thanks this is really helpful 👍 |
No description provided.
The text was updated successfully, but these errors were encountered: