-
Notifications
You must be signed in to change notification settings - Fork 76
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
Split packages between MigLayout Core and IdeUtil #103
Comments
Split packages problems I assume? But if you keep miglayout on the classpath, because it is not a module, then there should be no problems. |
That's sadly the problem.
For a normal Java project, that's true. But I probably should've mentioned that I use this jar in an OSGi environment... To break down the actual problem: We currently have a "fat" jar containing both
This is because the manifest file of Note: Even if this header existed, it would still not be possible to ensure that those are satisfied by As a workaround, it might be possible to simply add this dependency via the I think the clean solution would probably be to move the IDEUtil class to its own package. Though I assume that is undesirable because it would break API. |
After a quick test, that solves the ClassNotFoundException. But it only causes the next batch of exceptions...
UnitValue.ZERO is a package-private field which is accessed by IDEUtil. This only works if both classes are loaded by the same classloader... :( |
Okay. I cannot test in in OSGi environment, but renaming that package and adding line or two to the manifest is doable. Maybe you can test what works and make a PR? Or tell me what must change? |
That's the plan :) Though I fear that this might be a little bit more complicated than just adapting the manifest or moving some classes around. From what I can tell, the IDEUtil class is primarily used to expose package-private fields and methods from the Core jar. Meaning that moving it to a different package brings its own problems. I'll have to play around with it a little to hopefully come up with a good solution... |
I would suggest to simply move class |
I'm slowly getting the impression that this really is the cleanest solution. To briefly summarize the problem: package private fields and methods can only be accessed if two conditions are met.
In other words, I need to find a way to load IDEUtil with the same classloader that is used by miglayout-core. There are options to do it with e.g. SPI or similar mechanisms but in the end, I'm not sure if this is really worth the effort. |
Fine with me. See if that works? |
The IDEUtil class is used to expose package-private functionality from miglayout-core to external projects. This mechanism fails in an OSGi environment, because the IDEUtil class is loaded by a different classloader that is used to load classes it tries to access. To solve this problem, move IDEUtil to miglayout-core. Given that the ideutil project is now empty, it is removed from the repository. resolves mikaelgrev#103
The IDEUtil class is used to expose package-private functionality from miglayout-core to external projects. This mechanism fails in an OSGi environment, because the IDEUtil class is loaded by a different classloader that is used to load classes it tries to access. To solve this problem, move IDEUtil to miglayout-core. Given that the ideutil project is now empty, it is removed from the repository. resolves mikaelgrev#103
The IDEUtil class is used to expose package-private functionality from miglayout-core to external projects. This mechanism fails in an OSGi environment, because the IDEUtil class is loaded by a different classloader that is used to load classes it tries to access. To solve this problem, move IDEUtil to miglayout-core. Given that the ideutil project is now empty, it is removed from the repository. resolves mikaelgrev#103
You forget a reference in demo. |
My apologies. I've went through the project again, and I think there are other references that I missed as well. This should be fixed via #105
Awesome! Thank you both for your time. This really helps me out in getting rid of our embedded jars. :) |
No problem. Thanks for addressing the issue. |
Sorry for being late to the discussion, but it all seem to the the right way forward. There were reasons back then for keeping them separated, I hope.., but I can't recollect any of them today. |
Both the IDEUtil class and the Core Miglayout classes are located in the
net.miginfocom.layout
package. This causes problems in Java 9 with regards to e.g. modules.The text was updated successfully, but these errors were encountered: