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

[BUG] Delombok of SuperBuilder is incomplete, if there is already a constructor with one argument present. #3746

Open
aschepp opened this issue Sep 17, 2024 · 0 comments

Comments

@aschepp
Copy link

aschepp commented Sep 17, 2024

Describe the bug
Delombok of @SuperBuilder is incomplete, if there is already a constructor with one argument present.

To Reproduce

@Data
@SuperBuilder
public class ModelA {

	private List<String> list;

	public ModelA(List<String> list) {
		this.list = list;
	}
}

When using delombok for the SuperBuilder on the above class, the constructor for the builder is not created:

@Data
public class ModelA {

	private List<String> list;

	public ModelA(List<String> list) {
		this.list = list;
	}

	public static ModelABuilder<?, ?> builder() {
		return new ModelABuilderImpl();
	}

	public static abstract class ModelABuilder<C extends ModelA, B extends ModelABuilder<C, B>> {
		private List<String> list;

		public B list(List<String> list) {
			this.list = list;
			return self();
		}

		protected abstract B self();

		public abstract C build();

		public String toString() {
			return "ModelA.ModelABuilder(list=" + this.list + ")";
		}
	}

	private static final class ModelABuilderImpl extends ModelABuilder<ModelA, ModelABuilderImpl> {
		private ModelABuilderImpl() {
		}

		protected ModelABuilderImpl self() {
			return this;
		}

		public ModelA build() {
			return new ModelA(this);
		}
	}
}

Expected behavior
After delombok, both constructors should exist.

Version info (please complete the following information):
lombok 1.18.34
javac 17.0.12

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

1 participant