-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[BUG] ASM & Lombok while running Tests #3474
Comments
We're working on a solution ourselves. |
Hey @BjoernAkAManf - thanks for spotting this one. We've taken a different approach to the usual shader solutions (because the usual solutions are IMO rather bad). We published an edge release with this fix; can you test if it fixes the problem? Thank you! |
Hi guys! I don't think this fix works as intended though. Tested it in both IntelliJ and through maven. https://github.com/BjoernAkAManf/mre-lombok-asm/actions/runs/5760113052 EDIT: Also checked the Changelog includes the changes linked above. |
The change also breaks classloading in eclipse... |
@rzwitserloot could you reopen it? I think it got forgotten. |
It is included and part of the Edge Release. |
Hi @rzwitserloot i do not think that the issue is resolved, given my base mre is still failing. Error Message: Corrupted channel by directly writing to native stream in forked JVM 1. Stream 'java.lang.LayerInstantiationException: Package org.objectweb.asm in both module lombok and module org.objectweb.asm'. |
@BjoernAkAManf Thanks for testing it. I'm.. not sure what's left for us to do at this point. The code we wrote works and Clearly it is, but the problem is, I now have absolutely no idea where to take it from here. We'd need a self-contained test case that reliably triggers this problem without requiring us to download 5GB onto our drives and download a few book worth of knowledge on whatever project setup you have which might as this point be a challenge. Are you sure you're using the edge release in all places it matters? |
Hi @rzwitserloot the example linked above contains the following line in apache maven (distribution of which is 10mb). 2023-09-16T06:29:07.1030722Z [INFO] Downloading from projectlombok.org: https://projectlombok.org/edge-releases/org/projectlombok/lombok/edge-SNAPSHOT/lombok-edge-20230915.025955-1.jar The pom only defines the lombok repository (plus the central repository implicitly). Dependencies are only to JUnit, lombok and asm. Maven, Ant and Gradle are not that diffferent, so i'd assume that is not the issue. So as far as can see it's more or less git clone && mwnw verify to reproduce. I do not see where this reaches a file size of more than 1 GB let alone 5. Anything else i can help you with? I could probably create a shell example with hard coded jars as well, would that be more helpful? |
I'm suprised that this error occurs at runtime because lombok should not be at the classpath at that point. It is a compile time only dependency and the fix only affects the compilation steps. Can you try to exclude it for the surefire tests? |
@BjoernAkAManf No need for shell scripts. Sounds like your example repo here will do fine as test case. Reopening. |
EDIT: Our conclusions in this comment are wrong - see next comment for explanation of what's really going on here! Cloned the project.
|
It's the dejavu ticket that bounces between closed and reopened. Sooo, what's the programmer's version of treppenwitz? Where you toss in the towel, close the tabs and the relevant editors, and go do something else, and at that exact moment you go: Oh waaaaait a second? Anyway, that. Conclusion: Team OpenJDK is... ugh. They make bizarro and dangerous choices a lot. The wait a second moment is this: The JVM figures out this split package thing really quickly - like, we tell surefire to freeze on boot so we can maybe see that Unless.... The java runtime just opens the jar and scans directories. If it sees 2 directories that match it immediately goes: Oh, oh! Split packages, abort abort. Which is silly. Maybe wait until something is loaded from there? At any rate, that's it, that's why it still fails. It doesn't matter that we never load anything in the namespace, or that the concept of 'a package name' is a notion that exists only on the 'other side' of the classloader line (not on the 'go find the sources' line, it's on the We've now updated our shadowloader to work off of a subdir instead. I cannot reiterate how disappointingly bad this is from how the JDK loads modules. Just to confirm, adding a 0-length file to the jars with path Fix will make it in time for the imminent 1.18.30 release. It'll be closed, for the last time, in an hour or two while I go clean up the commits and write a note in the changelog for it. |
While I agree mostly with the sentiment, i think the requirement, that module directories are reserved to the actual module, so that classes and resources of a package only exist in their own Jar. It is not as intuitive as it should be. Especially with that error. However, I'm glad the issue is fixed. I'll update the Repository as fixed once i get around to it. =) |
It's a new term (apparently circa 2009), but maybe "shower thought"? |
Describe the bug
Trying to test an application with both ASM and lombok fails.
"Potential easy solution" (TM): Rename the lombok shaded ASM package, so other software does not fail.
To Reproduce
Trying to use ASM and lombok at the same time will fail when running Tests (using IntelliJ or Maven).
As far as i can see everything is as described by https://projectlombok.org/setup/maven.
Note that running the main Method works, however running jUnit will fail.
I created a minimal reproduceable example.
The error basically says that ASM is used by both lombok and ASM.
java.lang.LayerInstantiationException: Package org.objectweb.asm in both module lombok and module org.objectweb.asm
Expected behavior
Testing works out of the box and the Project compiles.
Version info (please complete the following information):
Additional context
See #2549 and #2973
PS: Thanks for the great software! I love using lombok, but it's quite a shame the issue above occurs. The previous listed issues boil down to:
I'd be willing to give a try implementing reshading, but understanding the code base has been quite hard for me in the past.
So any pointer, if that change would be welcome, would be appreciated.
The text was updated successfully, but these errors were encountered: