Support JPMS projects in delombok by wiring module path#1728
Merged
Conversation
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.
Member
Author
Work Summary — Automated MaintenanceChanges pushed
CI StatusAll build and example checks passed. CodeQL pending. |
Member
Author
Work Summary — Automated MaintenanceCode ReviewFull code review completed. No issues found requiring changes. The module-info detection in CI StatusAll checks previously passed. No changes pushed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
module-info.javais present in a source set, put the compile classpath on--module-pathinstead of--classpathso that javac (inside lombok) can resolve module dependenciesDelomboktask already had amodulePathproperty and generated--module-patharguments, but theLombokPluginnever configured itmodule-info.javacontainingrequires static lombokNote: 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
jpmsDelombokTestpassessimpleDelombokTeststill passes (non-JPMS unaffected)./gradlew checkpasses (310 tasks)