GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — [java] Fix #6731: Support lombok.Builder (fix UnnecessaryFullyQualifiedName false positive) by markjoin123 · Pull Request #7198 · pmd/pmd Conversation
|
|
Thanks for the review @oowekyala, that makes sense. I reworked the PR accordingly:
Tests: the #6731 cases in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I think we should address the following points (see also the individual comments):
SymbolTableResolver explaining why the generated builder class is added to the scope of the class's own annotations. Java scoping doesn't do this; the reason is a Lombok restriction. Since Lombok 1.18.48, @Builder(builderClassName = "Builder") must be written as @lombok.Builder. Also consider moving this block into a separate private method (e.g. addBuildersToAnnotationScope), so that desugarLombokMembers stays easy to read.@Builder on methods. Lombok names it after the method's return type, not the enclosing type (e.g. Bar$FooBuilder for static Foo create() in Bar). Please add a test for this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
fdec473 to
e0760e4
Compare
UnnecessaryFullyQualifiedName reported lombok.Builder when the generated builder class was named Builder. Add that static nested class to the enclosing type's symbol, as with other Lombok members, instead of special-casing the rule. The default name is <TypeName>Builder; builderClassName overrides it, and an existing nested class of that name is kept. Fixes pmd#6731
Address review feedback. Explain the Lombok annotation-scope restriction, return the synthetic builder classes that were added, and name @builder on a method after its return type (Desk$BookBuilder for static Book book()).
e0760e4 to
6a3fe12
Compare
There was an error while loading. Please reload this page.
|
Compared to main: (comment created at 2026-11-12 12:27:07+00:00 for b550479) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Resolve the conflicts with pmd#7198, which added the (empty) builder class of lombok.Builder. Build on that implementation instead of duplicating it: - keep the builder class of pmd#7198, including builders of constructors and methods, the '*' wildcard of builderClassName and the annotation scope - add the members for @builder on a non-generic class: the methods of the builder class, builder() and toBuilder() - honor the access attribute for the builder class - a handwritten builder class gets the methods it does not declare Builders of generic classes, constructors and methods stay empty classes. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01MTr23wWTVcrESgpWPAS9iR
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[java] UnnecessaryFullyQualifiedName: False positive for lombok.Builder annotation
There was an error while loading. Please reload this page.