Lombok: There should be @SuperBuilder.Default annotation in my understanding

Created on 22 Aug 2018  路  10Comments  路  Source: projectlombok/lombok

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

All 10 comments

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?

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

@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?

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

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.

@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.

@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?

@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.

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.

@janrieke Thx very much

Was this page helpful?
0 / 5 - 0 ratings