mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 04:16:19 +00:00
[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:
5 files changed
+99
-10
No files matched your search
@@ -0,0 +1,33 @@
|
||||
public @lombok.Builder class BuilderWithBadNames {
|
||||
public static @java.lang.SuppressWarnings("all") class BuilderWithBadNamesBuilder {
|
||||
private @java.lang.SuppressWarnings("all") String build;
|
||||
private @java.lang.SuppressWarnings("all") String toString;
|
||||
@java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder() {
|
||||
super();
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder build(final String build) {
|
||||
this.build = build;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder toString(final String toString) {
|
||||
this.toString = toString;
|
||||
return this;
|
||||
}
|
||||
public @java.lang.SuppressWarnings("all") BuilderWithBadNames build() {
|
||||
return new BuilderWithBadNames(build, toString);
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
|
||||
return (((("BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build) + ", toString=") + this.toString) + ")");
|
||||
}
|
||||
}
|
||||
String build;
|
||||
String toString;
|
||||
@java.lang.SuppressWarnings("all") BuilderWithBadNames(final String build, final String toString) {
|
||||
super();
|
||||
this.build = build;
|
||||
this.toString = toString;
|
||||
}
|
||||
public static @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder builder() {
|
||||
return new BuilderWithBadNamesBuilder();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user