GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Lombok: support `@Builder` on types by Pankraz76 · Pull Request #7241 · pmd/pmd

Conversation

@Pankraz76

@Pankraz76 Pankraz76 commented Oct 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Describe the PR

Adds symbols for what Lombok's @Builder generates when it is placed on a class:

  • the nested builder class, with one setter-like method per field and the build method
  • the static builder() method and, with toBuilder = true, the toBuilder() instance method

The attributes builderClassName, builderMethodName, buildMethodName, setterPrefix, toBuilder and access are honored, as is @Builder.Default. If the class already declares the builder class by hand, only the missing methods are added to it.

Not supported yet: generic classes, @Singular, @Builder on constructors or methods, and @SuperBuilder.

Related issues

  • Refs [java] Better Lombok support #3119

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
[java] Lombok: support @builder on types
73f4bc7
Creates the builder class, its setter-like methods and build method,
the static builder() method and toBuilder(). Honors builderClassName,
builderMethodName, buildMethodName, setterPrefix, toBuilder, access and
@Builder.Default, and completes handwritten builder classes.

Not supported: generic classes, @Singular, @builder on constructors
or methods, and @SuperBuilder.

Refs pmd#3119

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PPz9uxrZpT8ysmD5A2Fgg5
@Pankraz76 Pankraz76 changed the title [java] Lombok: support @Builder on types [java] Lombok: support @Builder on types Oct 26, 2026
@Pankraz76
Pankraz76 marked this pull request as ready for review October 26, 2026 07:51
@Pankraz76 Pankraz76 mentioned this pull request Oct 26, 2026
[java] Better Lombok support #3119
Open
@pmd-actions-helper

pmd-actions-helper Bot commented Oct 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-11-13 17:05:29+00:00 for 96146eb)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@adangel

adangel commented Nov 13, 2026

Copy link
Copy Markdown
Member

Thanks for creating the PR. Please ask Claude to compare your PR to the earlier PR #7198 (already merged) and update this PR if there are any differences left.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@claude
Merge branch 'main' into feat/3119-lombok-builder
96146eb
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
@Pankraz76

Pankraz76 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the pointer. I asked Claude to compare this PR with #7198 and merged main:

  • Redundant, removed here: creating the builder class and resolving builderClassName. This PR now reuses the class from [java] Fix #6731: Support lombok.Builder (fix UnnecessaryFullyQualifiedName false positive) #7198, including constructor/method builders, the * wildcard and the annotation scope.
  • Remaining delta: for @Builder on a non-generic class, the builder's methods (one per field plus build()), builder() and toBuilder(), honouring access, setterPrefix, builderMethodName, buildMethodName and @Builder.Default. A handwritten builder class gets the methods it does not declare.
  • Still unsupported: members for generic classes and for constructor/method builders, @Singular, @SuperBuilder.

Two behaviour changes against main: access now sets the visibility of every generated builder class, and access = AccessLevel.NONE generates nothing.

All tests from #7198 still pass; the full pmd-java suite and checkstyle are green locally.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Pankraz76 @adangel @claude
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.