Skip to content

Reject ambiguous Builder class name collisions - #4052

Open
snowykte0426 wants to merge 2 commits into
projectlombok:masterfrom
snowykte0426:bugfix/3857-builder-class-name-conflict
Open

Reject ambiguous Builder class name collisions#4052
snowykte0426 wants to merge 2 commits into
projectlombok:masterfrom
snowykte0426:bugfix/3857-builder-class-name-conflict

Conversation

@snowykte0426

Copy link
Copy Markdown
Contributor

Summary

  • reject simple-name @Builder when builderClassName resolves to Builder, suggesting @lombok.Builder instead
  • apply the same simple-name collision rule to @SuperBuilder / SuperBuilder
  • add javac and ECJ transform fixtures for rejected simple annotations and allowed fully-qualified annotations

Fixes #3857.

Tests

  • JAVA_HOME=$(/usr/libexec/java_home -v 21) ant -noinput test.javacCurrent
  • git diff --check
  • JAVA_HOME=$(/usr/libexec/java_home -v 21) ant -noinput dist test.eclipse-202503 confirms the new Builder/SuperBuilder cases pass; the target still fails later on existing ecj-ValUndenotable.java missing expected output.

@rspilker

rspilker commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

@snowykte0426 Thanks for this contribution as well. Can you add your name to the AUTHORS file, so we are legally covered?

In the meantime, we've promoted SuperBuilder out of experimental. Can you replace your references to lombok.experimental.SuperBuilder by lombok.SuperBuilder. experimental.SuperBuilder is not yet deprecated, but it will be in an upcoming release.

@snowykte0426
snowykte0426 force-pushed the bugfix/3857-builder-class-name-conflict branch from f6c00af to 70451b9 Compare August 7, 2026 00:28
@snowykte0426

Copy link
Copy Markdown
Contributor Author

Thanks, @rspilker! Added myself to AUTHORS.

I also rebased onto current master and replaced the remaining lombok.experimental.SuperBuilder references — the qualified name in the error message (javac + eclipse) and the test resources — with lombok.SuperBuilder. ant test passes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] builderClassName="Builder" results in code that compiles in Eclipse, but fails to compile in javac (in an edge case)

2 participants