@SuperBuilder needs to be finalized.

515 views
Skip to first unread message

Tom Harper

unread,
Jul 25, 2022, 3:48:33 PM7/25/22
to Project Lombok
I am a .Net Guru having to convert to Java.  

Given Oracle's lack of desire to bring Java up to the features .Net developers are used to, I was creating a base class with the common properties.  @Builder failed to do the required access to my "properties". @SuperBuilder does.  Currently @SuperBuilder is in the "experimental" phase.  It should replace @Builder.  

Why?   Properties that are protected, internal or public in a base class are exposed to children classes.  Constructors of the child class access private properties via the constructor overload.  @Builder fails this constraint, by default.  Boilerplate code must be used to create the access a developer is looking for.

Thanks 

Newell Rose

unread,
Jul 29, 2022, 10:40:02 AM7/29/22
to Project Lombok
Emphatically agree.  Superbuilder should replace Builder.

I would add one small tweak in the process:  Each implementation of a SuperBuilder should also have an interface defined.  This would avoid some of the complex type parameters.

Reinier Zwitserloot

unread,
Sep 6, 2022, 10:12:44 AM9/6/22
to Project Lombok
Request denied.

Explanation: `@SuperBuilder` adds a whole bevy of type annotations to make it work, and that implementation detail leaks out, we can't prevent that from happening. It is useful to be able to explain in simple terms what Builder actually does, and SuperBuilder makes it way more complicated to do so. Subclassing is rare enough that the burden is not worth it, so both will continue to exist. The easier to explain @Builder by default, @SuperBuilder if you need it.

Newell Rose wrote:
> Each implementation of a SuperBuilder should also have an interface defined.  This would avoid some of the complex type parameters.

I'm not sure I follow. Can you show an example of what it should desugar to? Note that this is highly unlikely to happen unless it's amazing, as it would be backwards incompatible (there is room - @SuperBuilder is still in experimental, but experimental is no excuse to frivolously annoy folks by changing what lombok is doing. There'd have to be an excellent reason).
Reply all
Reply to author
Forward
0 new messages