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

Investigate split packages and refactor to avoid any split packages across Grails and GORM for Java 11 #11162

Open
graemerocher opened this issue Nov 22, 2018 · 4 comments
Assignees
Projects

Comments

@graemerocher
Copy link
Member

No description provided.

@graemerocher graemerocher created this issue from a note in Grails 4.0 (To do) Nov 22, 2018
@niravassar niravassar self-assigned this Dec 19, 2018
@niravassar
Copy link

niravassar commented Dec 20, 2018

RESEARCH and SUMMARY

I 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

Examples

I 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

  • I think we have to strategize on how grails 4 is going to use modularization and to what extent we could utilize the backward compatibility mechanisms in the midst of the modularizing features.
  • If we re to go through all the grails-core packages and get rid of all split packages by renaming them to be distinct, how do we do this to at least programmatically identify those that are a problem. There are dozens of jars and 1000s of package names. I have some ideas but want to verify it prior.

Finding split packages

I found a way to find split packages using a gradle plugin. See example project here.

https://github.com/niravassar/java-gradle-splitpackage-plugin

@niravassar
Copy link

I am looking into how to run this plugin on a grails project to find all the collisions

@niravassar
Copy link

niravassar commented Dec 21, 2018

Java Project to find split packages

I 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
gradle-java9c-results.txt

@graemerocher
Copy link
Member Author

Thanks this is really helpful 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Grails 4.0
  
To do
Development

No branches or pull requests

2 participants