You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DTOParent {
private String a;
}
and a child, using @SuperBuilder and @Builder.Default
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DTO extends DTOParent {
@Builder.Default
private Integer number = 5;
}
The problem is that lombok and delombok generate different result.
Lombok on the left and delombok+compile on the right
Expected behavior
Lombok initializes the field annotated with @Builder.Default in no-args constructor, as I believe is expected
Delomboked code is missing that step
Version info (please complete the following information):
Lombok 1.18.22
The text was updated successfully, but these errors were encountered:
Screenshot in the issue description is showing two .class files, decompiled with Intellij. First one was compiled directly using lombok, the second one compiled from delomboked sources.
I still don't know how you managed to generate the code on the left side but I think that you actually found a bug. In 3987f54 support for @Builder.Default in @NoArgsConstructor was added. This works with javac if you use @Builder but not if you use @SuperBuilder. In ecj both annotations generate the initialization in the constructor so it most likely is an javac specific problem.
Describe the bug
There is a parent class
and a child, using
@SuperBuilder
and@Builder.Default
The problem is that lombok and delombok generate different result.
Lombok on the left and delombok+compile on the right
Expected behavior
Lombok initializes the field annotated with @Builder.Default in no-args constructor, as I believe is expected
Delomboked code is missing that step
Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: