Skip to content

Support JPMS projects in delombok by wiring module path#1728

Merged
larsgrefer merged 2 commits into
mainfrom
fix/delombok-jpms-module-path
Apr 20, 2026
Merged

Support JPMS projects in delombok by wiring module path#1728
larsgrefer merged 2 commits into
mainfrom
fix/delombok-jpms-module-path

Conversation

@Frisch12

@Frisch12 Frisch12 commented Apr 3, 2026

Copy link
Copy Markdown
Member

Summary

  • When module-info.java is present in a source set, put the compile classpath on --module-path instead of --classpath so that javac (inside lombok) can resolve module dependencies
  • The Delombok task already had a modulePath property and generated --module-path arguments, but the LombokPlugin never configured it
  • Non-modular projects are completely unaffected (conditional detection)
  • Added a test that verifies delombok works with module-info.java containing requires static lombok

Note: Lombok itself has known JPMS limitations (projectlombok/lombok#2829, projectlombok/lombok#3389) that may still cause issues in complex module setups. This fix addresses the plugin-level gap where the module path was never passed to delombok at all.

Closes #1597

Test plan

  • New jpmsDelombokTest passes
  • Existing simpleDelombokTest still passes (non-JPMS unaffected)
  • Full ./gradlew check passes (310 tasks)

Frisch12 added 2 commits April 3, 2026 23:29
When a source set contains module-info.java, javac (inside lombok) switches
to module mode and expects modular dependencies on --module-path instead of
--classpath. The Delombok task already had a modulePath property but the
LombokPlugin never configured it.

Detect module-info.java in the source directories and put the compile
classpath on --module-path instead of --classpath for JPMS projects.
Non-modular projects are unaffected.

Add a test that verifies delombok works with a module-info.java containing
requires static lombok.

Closes #1597
Restrict the glob from **/module-info.java to module-info.java so only
root-level module descriptors trigger module-path mode. A module-info.java
nested in a subdirectory is not a valid JPMS descriptor and should not
activate --module-path.
@Frisch12

Copy link
Copy Markdown
Member Author

Work Summary — Automated Maintenance

Changes pushed

  • Fixed module-info.java detection glob — changed **/module-info.java to module-info.java so only root-level module descriptors trigger module-path mode. A nested module-info.java is not a valid JPMS descriptor.

CI Status

All build and example checks passed. CodeQL pending.

@Frisch12

Copy link
Copy Markdown
Member Author

Work Summary — Automated Maintenance

Code Review

Full code review completed. No issues found requiring changes. The module-info detection in afterEvaluate is appropriate since source directories are fully resolved at that point. JPMS test coverage is adequate.

CI Status

All checks previously passed. No changes pushed.

@larsgrefer larsgrefer merged commit 724b957 into main Apr 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't delombok java module

2 participants