这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG] delomboked class is missing @Builder.Default initialization in no args constructor #3053

@Alexey007gold

Description

@Alexey007gold

Describe the bug
There is a parent class

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
image

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions