Conversation
sullis
force-pushed
the
consolidate-lombok-config
branch
4 times, most recently
from
September 10, 2026 02:11
d5a4e5d to
6850300
Compare
sullis
force-pushed
the
consolidate-lombok-config
branch
2 times, most recently
from
September 10, 2026 02:42
c66c2be to
028c6d2
Compare
sullis
force-pushed
the
consolidate-lombok-config
branch
from
September 10, 2026 02:48
028c6d2 to
dfc4575
Compare
sullis
marked this pull request as ready for review
September 10, 2026 03:13
Contributor
Author
|
Ready for review @greg-at-moderne @timtebeek |
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.
Adds two
lombok.configrecipes, built on a sharedLombokConfighelper that parses and classifies the directives of a config file following the line grammar of Lombok's ownConfigurationParser. Both recipes act on thelombok.configat the root of the repository, and read any*.configfile that was parsed as text, since animportnames a file by path rather than by name.Neither recipe is added to
LombokBestPractices; both are registered inMETA-INF/rewrite/recipes.csvand are run on their own.ConsolidateLombokConfigMerges the directives of every nested
lombok.configinto the rootlombok.configand deletes the nested files, so a project has a single place where Lombok is configured.+=from a directory above another still adds to the list before it does.=,+=and-=is normalized for comparison only, sokey=valueandkey = valuededupe against each other, as do keys spelled with a different case.+=is carried over once per distinct value, since each adds to the same list rather than replacing what came before.What is intentionally left alone
A nested file stays in place when hoisting it would change what Lombok does:
config.stopBubblingopts its directory, and everything under it, out of the root configuration. Only an explicitfalsekeeps bubbling on; a value that can't be read as a boolean is treated as stopping bubbling, so the directory is left alone rather than hoisted on a guess.importresolves relative to the file that declares it.clearand-=depend on their order relative to the additions they undo.lombok.configbetween it and the root speaks about one of the same directives, or imports a file that may, since that file would outrank the root once the directive moved there. A file that says exactly the same thing isn't shadowing it and doesn't block the hoist.lombok.configimports it, so deleting it would leave that import pointing at nothing.src/test/resources, say — since Lombok never reads it. A source counts by its.javaname, so one Lombok compiles but this recipe didn't parse counts all the same. A config governing test sources is ordinary configuration and is hoisted; when a project has no Java sources at all there's no layout to judge against, so each config is taken at its word.The recipe makes no changes at all when:
lombok.configat the root of the repository, since there is nowhere to consolidate to.=assignments can conflict; several+=and-=of one key are expected to coexist, and an assignment a file supersedes later on isn't weighed against another file.clears or-=s a key that a nested file speaks about, since appending that directive after the root's line would put back what the root deliberately took away.Note that hoisting widens a directive's scope from one directory to the whole project, which is called out in the recipe description (e.g.
lombok.val.flagUsage = error).AddStopBubblingToLombokConfigAppends
config.stopBubbling = trueto the rootlombok.configwhen it does not already declare that key, so Lombok reads the project's configuration and nothing else. Lombok resolves a key by walking up from the directory of the Java file it is compiling and does not stop at the project, so without this key alombok.configin a parent directory of wherever the project happens to be checked out takes part in the build.lombok.configfiles are left alone; only the root file is changed.lombok.configwhether or not it was meant to be read, so the recipe is standalone rather than part ofLombokBestPractices.Tests
ConsolidateLombokConfigTest(62 tests) covers merging, merge ordering of deeply nested configs, deduplication, conflict detection, each non-hoistable case above,stopBubblingancestors (including one that turns bubbling back on), import resolution and cycles, comment handling, case-insensitive keys, mixed hoistable/unhoistable trees, Java-source layout, CRLF and missing-trailing-newline root files, and the no-root-config and no-config-at-all cases.AddStopBubblingToLombokConfigTest(16 tests) covers the addition, each case where nothing is added, and the same formatting-preservation cases.🤖 Generated with Claude Code