Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] @SuperBuilder does work on classes named B or C #2297

Closed
janrieke opened this issue Nov 24, 2019 · 4 comments · Fixed by #2355
Closed

[BUG] @SuperBuilder does work on classes named B or C #2297

janrieke opened this issue Nov 24, 2019 · 4 comments · Fixed by #2355

Comments

@janrieke
Copy link
Contributor

janrieke commented Nov 24, 2019

Describe the bug
@SuperBuilder causes a compilation error when used on classes named B or C.

To Reproduce
Put @SuperBuilder on a class named B or C.

Expected behavior
Compiles.

Version info:

  • Lombok version 1.18.10
  • javac and eclipse

Additional context
Right now lombok only avoids name clashes between builder generics and the class's type parameters. When I implemented @SuperBuilder, I forgot to also check for clashes with the class name itself. :(

@OLPMO
Copy link

OLPMO commented Dec 5, 2019

Could you provide a small sample the reproduces that behaviour you've described?

@janrieke
Copy link
Contributor Author

If you insist ;-)

@SuperBuilder public class B {}

@rzwitserloot
Copy link
Collaborator

I'm not too worried about classes named B, but... how about:

@SuperBuilder class Example<B> {}

Looks like you're already working on a PR; should I wait for you to finish this?

@janrieke
Copy link
Contributor Author

janrieke commented Jan 15, 2020

The type parameters on the class are OK, those are already checked against collisions.

It's just the class name or classes referenced e.g. by fields (e.g. private C myC).

I'm also not sure if it's worth the effort: Checking just the class name is easy (my commit already does that), but for referenced classes we'd have to go through the complete source of the compilation unit to find possible collisions. I don't know the performance impact of that. And naming classes B or C is almost always bad style.

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 a pull request may close this issue.

3 participants