[fixes #2011] If you have a field named build or toString, and you generate a builder, that builder wouldn’t make the build or toString methods because it thinks the builder-setter methods it just generated that so happen to have that name indicate you don’t want lombok to do that.

You really shouldn’t name any fields builder or toString, though.
This commit is contained in:
Reinier Zwitserloot committed 2019-01-29 01:34:22 +01:00
1 parent 960811364b
commit 3d0beec38d
5 files changed
+99 -10

No files matched your search

@@ -0,0 +1,42 @@
public class BuilderWithBadNames {
String build;
String toString;
@java.lang.SuppressWarnings("all")
BuilderWithBadNames(final String build, final String toString) {
this.build = build;
this.toString = toString;
}
@java.lang.SuppressWarnings("all")
public static class BuilderWithBadNamesBuilder {
@java.lang.SuppressWarnings("all")
private String build;
@java.lang.SuppressWarnings("all")
private String toString;
@java.lang.SuppressWarnings("all")
BuilderWithBadNamesBuilder() {
}
@java.lang.SuppressWarnings("all")
public BuilderWithBadNamesBuilder build(final String build) {
this.build = build;
return this;
}
@java.lang.SuppressWarnings("all")
public BuilderWithBadNamesBuilder toString(final String toString) {
this.toString = toString;
return this;
}
@java.lang.SuppressWarnings("all")
public BuilderWithBadNames build() {
return new BuilderWithBadNames(build, toString);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build + ", toString=" + this.toString + ")";
}
}
@java.lang.SuppressWarnings("all")
public static BuilderWithBadNamesBuilder builder() {
return new BuilderWithBadNamesBuilder();
}
}