这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG] ASM & Lombok while running Tests #3474

@BjoernAkAManf

Description

@BjoernAkAManf

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):

  • Lombok version 1.18.28
  • Platform maven 3.9.2 and IntelliJ IntelliJ IDEA 2023.2 (Ultimate Edition) Build #IU-232.8660.185, built on July 26, 2023

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:

  1. Use explicit Annotation Processor (i specified them)
  2. Require static lombok (i do)
  3. No minimal example provided (see above)
  4. User Error (I don't see how i'm doing something wrong, and i don't think JUnit / Maven is doing something explicitely wrong. Especially given, that lombok can be quite helpful generating Test Data Classes, where records do not suffice.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions