fix(delombok): add sourcepath when module-info.java is present - #1754
Merged
larsgrefer merged 1 commit intoApr 28, 2026
Merged
Conversation
When a source set contains module-info.java, delombok already puts the compile classpath on the module path. However, without the source directories on the sourcepath, javac emits errors: error: file should be on source path, or on patch path for module This adds the source directories to the sourcepath in the same hasModuleInfo branch, consistent with the existing modulePath setup.
dtrunk90
added a commit
to slugify/slugify
that referenced
this pull request
Apr 29, 2026
dtrunk90
added a commit
to slugify/slugify
that referenced
this pull request
Apr 29, 2026
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.
Problem
When a source set contains
module-info.java, the delombok task already setsmodulePathfrom the compile classpath (added in thehasModuleInfobranch).However, the source directories are not added to
sourcepathin that case.This causes javac (invoked internally by Lombok's delombok) to emit errors for
every source file in the compilation unit:
These errors are non-fatal — delombok still produces correct output — but they
are noisy and misleading.
Root cause
When javac processes
module-info.javain module mode, it requires the module'ssource root to be declared via
--source-pathso it can correctly associatesource files with the named module. Without it, javac cannot determine which
module the input files belong to.
The plugin already adds the annotation processor output directory to
sourcepath(line 117), but omits the actual source directories when
module-info.javaispresent.
Fix
Add
sourceSet.getJava().getSourceDirectories()to the sourcepath in the samehasModuleInfobranch that already configures the module path: