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

There should be @SuperBuilder.Default annotation in my understanding #1826

Closed
kingraser opened this issue Aug 22, 2018 · 10 comments
Closed

There should be @SuperBuilder.Default annotation in my understanding #1826

kingraser opened this issue Aug 22, 2018 · 10 comments

Comments

@kingraser
Copy link

I used lombok 1.18.2, and I find @Builder.Default is not supported by the class which annotated by @SuperBuilder

@janrieke
Copy link
Contributor

janrieke commented Aug 22, 2018

It is supported. However, there are two issues concerning final, @NonNull and @*ArgsConstructor which will be fixed with PRs #1818 and #1820.

Or do you have another issue not covered by these PRs?

@kingraser
Copy link
Author

Thanks for your work!
I am wondering when can we get the fixed stable version?

@kingraser
Copy link
Author

kingraser commented Aug 23, 2018

@janrieke Another question is that when I use both Data and SuperBuilder in Idea, I got a warning that

Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '(callSuper=false)' to your type

can Data manage callsuper boolean value?

@koenverwimp
Copy link

Hi, I running into the same problem. Please let us know when this update is available.

@janrieke
Copy link
Contributor

janrieke commented Aug 26, 2018

That @Data problem (not calling super) seems to be a different problem unrelated to @SuperBuilder. I'm getting the warning even without the @SuperBuilder annotation. Can you also confirm that, @kingraser?

EDIT: The warning is intentional, see the lombok documentation on @EqualsAndHashCode. So you have to explicitly add @EqualsAndHashCode(callSuper=true) to your subclasses even though they already have the annotation implicitly via @Data.

@kingraser
Copy link
Author

@janrieke
Yes, I think you are right. The problem is unrelated to @SuperBuilder annotation.

I just wondering if we can have annotation like this @Data(callSuper=true) ,
so the code will be much more elegant than explicitly add @EqualsAndHashCode(callSuper=true) annotation.

@janrieke
Copy link
Contributor

@kingraser: All PRs relevant to this issue are now merged. Could you give the latest edge release a try to confirm this issue is fixed?

@kingraser
Copy link
Author

@janrieke
Thanks very much, I've just tried and I think the issue is fixed.
Another thing is that can We have a annotation like this @Data(callSuper=true)
So the callSuper can be used for both @EqualsAndHashCode and @ToString
Thanks for your dedicated work.

@janrieke
Copy link
Contributor

janrieke commented Aug 29, 2018

You can configure lombok to always callSuper without a warning using lombok.config:

lombok.equalsAndHashCode.callSuper=call

If this is not sufficient for you, there are already some other issues open on that topic (#92, #1078, PR #69), and there are some ideas related to it (e.g., https://github.com/rzwitserloot/lombok/wiki/FEATURE-IDEA:-@SuperToString). Please use the existing issues to discuss that topic.

This issue can be closed here.

@kingraser
Copy link
Author

@janrieke Thx very much

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

No branches or pull requests

3 participants