aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/changelog.markdown1
-rw-r--r--src/core/lombok/Builder.java4
-rw-r--r--src/core/lombok/ConfigurationKeys.java7
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleBuilder.java16
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleSuperBuilder.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java34
-rw-r--r--src/core/lombok/javac/handlers/HandleSuperBuilder.java10
-rw-r--r--test/transform/resource/after-delombok/BuilderComplex.java18
-rw-r--r--test/transform/resource/after-delombok/BuilderCustomName.java47
-rw-r--r--test/transform/resource/after-ecj/BuilderComplex.java18
-rw-r--r--test/transform/resource/after-ecj/BuilderCustomName.java37
-rw-r--r--test/transform/resource/before/BuilderComplex.java1
-rw-r--r--test/transform/resource/before/BuilderCustomName.java7
-rw-r--r--test/transform/resource/before/BuilderJavadoc.java5
-rw-r--r--website/templates/features/Builder.html4
-rw-r--r--website/templates/features/experimental/SuperBuilder.html4
16 files changed, 173 insertions, 46 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index f7c62c2c..be4b250a 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -4,6 +4,7 @@ Lombok Changelog
### v1.18.9 "Edgy Guinea Pig"
* ENHANCEMENT: Thanks to Mark Haynes, the `staticConstructor` will now also be generated if a (private) constructor already exists. [Issue #2100](https://github.com/rzwitserloot/lombok/issues/2100)
* ENHANCEMENT: `val` is now capable of decoding the type of convoluted expressions (particularly if the right hand side involves lambdas and conditional (ternary) expressions). [Pull Request #2109](https://github.com/rzwitserloot/lombok/pull/2109) with thanks to Alexander Bulgakov.
+* ENHANCEMENT: You can now configure the generated builder class name via the config system, using key `lombok.builder.className`. See the [Builder documentation](https://projectlombok.org/features/Builder) and [SuperBuilder documentation](https://projectlombok.org/features/experimental/SuperBuilder)
* BUGFIX: Delombok would turn something like `List<byte[]>...` in a method parameter to `List<byte...>...` [Issue #2140](https://github.com/rzwitserloot/lombok/issues/2140)
* BUGFIX: Javac would generate the wrong equals and hashCode if a type-use annotation was put on an array type field [Issue #2165](https://github.com/rzwitserloot/lombok/issues/2165)
diff --git a/src/core/lombok/Builder.java b/src/core/lombok/Builder.java
index a60af9ee..dfa5ecb5 100644
--- a/src/core/lombok/Builder.java
+++ b/src/core/lombok/Builder.java
@@ -129,9 +129,9 @@ public @interface Builder {
/**
* Name of the builder class.
*
- * Default for {@code @Builder} on types and constructors: {@code (TypeName)Builder}.
+ * Default for {@code @Builder} on types and constructors: see the configkey {@code lombok.builder.className}, which if not set defaults to {@code (TypeName)Builder}.
* <p>
- * Default for {@code @Builder} on methods: {@code (ReturnTypeName)Builder}.
+ * Default for {@code @Builder} on methods: see the configkey {@code lombok.builder.className}, which if not set defaults to {@code (ReturnTypeName)Builder}.
*
* @return Name of the builder class that will be generated (or if it already exists, will be filled with builder elements).
*/
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index 84b594f5..975cb72e 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -256,6 +256,13 @@ public class ConfigurationKeys {
// ----- Builder -----
/**
+ * lombok configuration: {@code lombok.builder.classNames} = &lt;String: aJavaIdentifier (optionally with a star as placeholder for the type name)&gt; (Default: {@code *Builder}).
+ *
+ * For any usage of the {@code @Builder} annotation without an explicit {@code builderClassName} parameter, this value is used to determine the name of the builder class to generate (or to adapt if such an inner class already exists).
+ */
+ public static final ConfigurationKey<String> BUILDER_CLASS_NAME = new ConfigurationKey<String>("lombok.builder.className", "Default name of the generated builder class. A * is replaced with the name of the relevant type (default = *Builder).") {};
+
+ /**
* lombok configuration: {@code lombok.builder.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Builder} results in a warning / error.
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index 96431a83..aa9d2147 100755
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -209,6 +209,10 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
List<EclipseNode> nonFinalNonDefaultedFields = null;
+ if (builderClassName.isEmpty()) builderClassName = annotationNode.getAst().readConfiguration(ConfigurationKeys.BUILDER_CLASS_NAME);
+ if (builderClassName == null || builderClassName.isEmpty()) builderClassName = "*Builder";
+ boolean replaceNameInBuilderClassName = builderClassName.contains("*");
+
if (parent.get() instanceof TypeDeclaration) {
tdParent = parent;
TypeDeclaration td = (TypeDeclaration) tdParent.get();
@@ -265,7 +269,8 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
typeParams = td.typeParameters;
thrownExceptions = null;
nameOfStaticBuilderMethod = null;
- if (builderClassName.isEmpty()) builderClassName = new String(td.name) + "Builder";
+ if (replaceNameInBuilderClassName) builderClassName = builderClassName.replace("*", new String(td.name));
+ replaceNameInBuilderClassName = false;
} else if (parent.get() instanceof ConstructorDeclaration) {
ConstructorDeclaration cd = (ConstructorDeclaration) parent.get();
if (cd.typeParameters != null && cd.typeParameters.length > 0) {
@@ -279,12 +284,13 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
typeParams = td.typeParameters;
thrownExceptions = cd.thrownExceptions;
nameOfStaticBuilderMethod = null;
- if (builderClassName.isEmpty()) builderClassName = new String(cd.selector) + "Builder";
+ if (replaceNameInBuilderClassName) builderClassName = builderClassName.replace("*", new String(cd.selector));
+ replaceNameInBuilderClassName = false;
} else if (parent.get() instanceof MethodDeclaration) {
MethodDeclaration md = (MethodDeclaration) parent.get();
tdParent = parent.up();
isStatic = md.isStatic();
-
+
if (toBuilder) {
final String TO_BUILDER_NOT_SUPPORTED = "@Builder(toBuilder=true) is only supported if you return your own type.";
char[] token;
@@ -360,7 +366,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
typeParams = md.typeParameters;
thrownExceptions = md.thrownExceptions;
nameOfStaticBuilderMethod = md.selector;
- if (builderClassName.isEmpty()) {
+ if (replaceNameInBuilderClassName) {
char[] token;
if (md.returnType instanceof QualifiedTypeReference) {
char[][] tokens = ((QualifiedTypeReference) md.returnType).tokens;
@@ -387,7 +393,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
token = newToken;
}
- builderClassName = new String(token) + "Builder";
+ builderClassName = builderClassName.replace("*", new String(token));
}
} else {
annotationNode.addError("@Builder is only supported on types, constructors, and methods.");
diff --git a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
index 9a86d372..f204bc24 100755
--- a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
@@ -203,7 +203,9 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
}
// Set the names of the builder classes.
- String builderClassName = String.valueOf(td.name) + "Builder";
+ String builderClassNameTemplate = annotationNode.getAst().readConfiguration(ConfigurationKeys.BUILDER_CLASS_NAME);
+ if (builderClassNameTemplate == null || builderClassNameTemplate.isEmpty()) builderClassNameTemplate = "*Builder";
+ String builderClassName = builderClassNameTemplate.replace("*", String.valueOf(td.name));
String builderImplClassName = builderClassName + "Impl";
typeParams = td.typeParameters != null ? td.typeParameters : new TypeParameter[0];
@@ -228,7 +230,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
if (extendsClause instanceof QualifiedTypeReference) {
QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference)extendsClause;
String superclassClassName = String.valueOf(qualifiedTypeReference.getLastToken());
- String superclassBuilderClassName = superclassClassName + "Builder";
+ String superclassBuilderClassName = builderClassNameTemplate.replace("*", superclassClassName);
char[][] tokens = Arrays.copyOf(qualifiedTypeReference.tokens, qualifiedTypeReference.tokens.length + 1);
tokens[tokens.length] = superclassBuilderClassName.toCharArray();
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index d758f602..b339c2ca 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -157,6 +157,10 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
ArrayList<JavacNode> nonFinalNonDefaultedFields = null;
+ if (builderClassName.isEmpty()) builderClassName = annotationNode.getAst().readConfiguration(ConfigurationKeys.BUILDER_CLASS_NAME);
+ if (builderClassName == null || builderClassName.isEmpty()) builderClassName = "*Builder";
+ boolean replaceNameInBuilderClassName = builderClassName.contains("*");
+
if (parent.get() instanceof JCClassDecl) {
tdParent = parent;
JCClassDecl td = (JCClassDecl) tdParent.get();
@@ -211,7 +215,8 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
typeParams = td.typarams;
thrownExceptions = List.nil();
nameOfBuilderMethod = null;
- if (builderClassName.isEmpty()) builderClassName = td.name.toString() + "Builder";
+ if (replaceNameInBuilderClassName) builderClassName = builderClassName.replace("*", td.name.toString());
+ replaceNameInBuilderClassName = false;
} else if (fillParametersFrom != null && fillParametersFrom.getName().toString().equals("<init>")) {
JCMethodDecl jmd = (JCMethodDecl) fillParametersFrom.get();
if (!jmd.typarams.isEmpty()) {
@@ -225,7 +230,8 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
typeParams = td.typarams;
thrownExceptions = jmd.thrown;
nameOfBuilderMethod = null;
- if (builderClassName.isEmpty()) builderClassName = td.name.toString() + "Builder";
+ if (replaceNameInBuilderClassName) builderClassName = builderClassName.replace("*", td.name.toString());
+ replaceNameInBuilderClassName = false;
} else if (fillParametersFrom != null) {
tdParent = parent.up();
JCClassDecl td = (JCClassDecl) tdParent.get();
@@ -239,9 +245,10 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
if (returnType instanceof JCTypeApply) {
returnType = cloneType(tdParent.getTreeMaker(), returnType, ast, annotationNode.getContext());
}
- if (builderClassName.isEmpty()) {
+ if (replaceNameInBuilderClassName) {
+ String replStr = null;
if (returnType instanceof JCFieldAccess) {
- builderClassName = ((JCFieldAccess) returnType).name.toString() + "Builder";
+ replStr = ((JCFieldAccess) returnType).name.toString();
} else if (returnType instanceof JCIdent) {
Name n = ((JCIdent) returnType).name;
@@ -251,27 +258,30 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
return;
}
}
- builderClassName = n.toString() + "Builder";
+ replStr = n.toString();
} else if (returnType instanceof JCPrimitiveTypeTree) {
- builderClassName = returnType.toString() + "Builder";
- if (Character.isLowerCase(builderClassName.charAt(0))) {
- builderClassName = Character.toTitleCase(builderClassName.charAt(0)) + builderClassName.substring(1);
+ replStr = returnType.toString();
+ if (Character.isLowerCase(replStr.charAt(0))) {
+ replStr = Character.toTitleCase(replStr.charAt(0)) + replStr.substring(1);
}
} else if (returnType instanceof JCTypeApply) {
JCExpression clazz = ((JCTypeApply) returnType).clazz;
if (clazz instanceof JCFieldAccess) {
- builderClassName = ((JCFieldAccess) clazz).name + "Builder";
+ replStr = ((JCFieldAccess) clazz).name.toString();
} else if (clazz instanceof JCIdent) {
- builderClassName = ((JCIdent) clazz).name + "Builder";
+ replStr = ((JCIdent) clazz).name.toString();
}
}
- if (builderClassName.isEmpty()) {
+ if (replStr == null || replStr.isEmpty()) {
// This shouldn't happen.
System.err.println("Lombok bug ID#20140614-1651: javac HandleBuilder: return type to name conversion failed: " + returnType.getClass());
- builderClassName = td.name.toString() + "Builder";
+ replStr = td.name.toString();
}
+ builderClassName = builderClassName.replace("*", replStr);
+ replaceNameInBuilderClassName = false;
}
+ if (replaceNameInBuilderClassName) builderClassName = builderClassName.replace("*", td.name.toString());
if (toBuilder) {
final String TO_BUILDER_NOT_SUPPORTED = "@Builder(toBuilder=true) is only supported if you return your own type.";
if (returnType instanceof JCArrayTypeTree) {
diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
index 0fcaa5f8..9120fa07 100644
--- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
@@ -177,7 +177,9 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
}
// Set the names of the builder classes.
- String builderClassName = td.name.toString() + "Builder";
+ String builderClassNameTemplate = annotationNode.getAst().readConfiguration(ConfigurationKeys.BUILDER_CLASS_NAME);
+ if (builderClassNameTemplate == null || builderClassNameTemplate.isEmpty()) builderClassNameTemplate = "*Builder";
+ String builderClassName = builderClassNameTemplate.replace("*", td.name.toString());
String builderImplClassName = builderClassName + "Impl";
JCTree extendsClause = Javac.getExtendsClause(td);
JCExpression superclassBuilderClassExpression = null;
@@ -189,11 +191,11 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
}
if (extendsClause instanceof JCFieldAccess) {
Name superclassClassName = ((JCFieldAccess)extendsClause).getIdentifier();
- String superclassBuilderClassName = superclassClassName + "Builder";
+ String superclassBuilderClassName = builderClassNameTemplate.replace("*", superclassClassName);
superclassBuilderClassExpression = tdParent.getTreeMaker().Select((JCFieldAccess) extendsClause,
- tdParent.toName(superclassBuilderClassName));
+ tdParent.toName(superclassBuilderClassName));
} else if (extendsClause != null) {
- String superclassBuilderClassName = extendsClause.toString() + "Builder";
+ String superclassBuilderClassName = builderClassNameTemplate.replace("*", extendsClause.toString());
superclassBuilderClassExpression = chainDots(tdParent, extendsClause.toString(), superclassBuilderClassName);
}
// If there is no superclass, superclassBuilderClassExpression is still == null at this point.
diff --git a/test/transform/resource/after-delombok/BuilderComplex.java b/test/transform/resource/after-delombok/BuilderComplex.java
index a89d7114..c63d7b59 100644
--- a/test/transform/resource/after-delombok/BuilderComplex.java
+++ b/test/transform/resource/after-delombok/BuilderComplex.java
@@ -3,7 +3,7 @@ class BuilderComplex {
private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) {
}
@java.lang.SuppressWarnings("all")
- public static class VoidBuilder<T extends Number> {
+ public static class TestVoidName<T extends Number> {
@java.lang.SuppressWarnings("all")
private T number;
@java.lang.SuppressWarnings("all")
@@ -13,25 +13,25 @@ class BuilderComplex {
@java.lang.SuppressWarnings("all")
private BuilderComplex selfRef;
@java.lang.SuppressWarnings("all")
- VoidBuilder() {
+ TestVoidName() {
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> number(final T number) {
+ public TestVoidName<T> number(final T number) {
this.number = number;
return this;
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> arg2(final int arg2) {
+ public TestVoidName<T> arg2(final int arg2) {
this.arg2 = arg2;
return this;
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> arg3(final String arg3) {
+ public TestVoidName<T> arg3(final String arg3) {
this.arg3 = arg3;
return this;
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> selfRef(final BuilderComplex selfRef) {
+ public TestVoidName<T> selfRef(final BuilderComplex selfRef) {
this.selfRef = selfRef;
return this;
}
@@ -42,11 +42,11 @@ class BuilderComplex {
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
- return "BuilderComplex.VoidBuilder(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")";
+ return "BuilderComplex.TestVoidName(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")";
}
}
@java.lang.SuppressWarnings("all")
- public static <T extends Number> VoidBuilder<T> builder() {
- return new VoidBuilder<T>();
+ public static <T extends Number> TestVoidName<T> builder() {
+ return new TestVoidName<T>();
}
}
diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java
new file mode 100644
index 00000000..4db08220
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderCustomName.java
@@ -0,0 +1,47 @@
+import java.util.List;
+class BuilderCustomName<T> {
+ private final int field;
+ @java.lang.SuppressWarnings("all")
+ public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> {
+ @java.lang.SuppressWarnings("all")
+ private int field;
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @java.lang.SuppressWarnings("all")
+ public abstract C build();
+ @java.lang.SuppressWarnings("all")
+ public B field(final int field) {
+ this.field = field;
+ return self();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderCustomName.SimpleTestBuilder(field=" + this.field + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> {
+ @java.lang.SuppressWarnings("all")
+ private SimpleTestBuilderImpl() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected SimpleTestBuilderImpl<T> self() {
+ return this;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public BuilderCustomName<T> build() {
+ return new BuilderCustomName<T>(this);
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) {
+ this.field = b.field;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <T> SimpleTestBuilder<T, ?, ?> builder() {
+ return new SimpleTestBuilderImpl<T>();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/BuilderComplex.java b/test/transform/resource/after-ecj/BuilderComplex.java
index 93d70fe9..23dbf058 100644
--- a/test/transform/resource/after-ecj/BuilderComplex.java
+++ b/test/transform/resource/after-ecj/BuilderComplex.java
@@ -1,27 +1,27 @@
import java.util.List;
import lombok.Builder;
class BuilderComplex {
- public static @java.lang.SuppressWarnings("all") class VoidBuilder<T extends Number> {
+ public static @java.lang.SuppressWarnings("all") class TestVoidName<T extends Number> {
private @java.lang.SuppressWarnings("all") T number;
private @java.lang.SuppressWarnings("all") int arg2;
private @java.lang.SuppressWarnings("all") String arg3;
private @java.lang.SuppressWarnings("all") BuilderComplex selfRef;
- @java.lang.SuppressWarnings("all") VoidBuilder() {
+ @java.lang.SuppressWarnings("all") TestVoidName() {
super();
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> number(final T number) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> number(final T number) {
this.number = number;
return this;
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg2(final int arg2) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> arg2(final int arg2) {
this.arg2 = arg2;
return this;
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg3(final String arg3) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> arg3(final String arg3) {
this.arg3 = arg3;
return this;
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> selfRef(final BuilderComplex selfRef) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> selfRef(final BuilderComplex selfRef) {
this.selfRef = selfRef;
return this;
}
@@ -29,7 +29,7 @@ class BuilderComplex {
BuilderComplex.<T>testVoidWithGenerics(number, arg2, arg3, selfRef);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((((((("BuilderComplex.VoidBuilder(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")");
+ return (((((((("BuilderComplex.TestVoidName(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")");
}
}
BuilderComplex() {
@@ -37,7 +37,7 @@ class BuilderComplex {
}
private static @Builder(buildMethodName = "execute") <T extends Number>void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) {
}
- public static @java.lang.SuppressWarnings("all") <T extends Number>VoidBuilder<T> builder() {
- return new VoidBuilder<T>();
+ public static @java.lang.SuppressWarnings("all") <T extends Number>TestVoidName<T> builder() {
+ return new TestVoidName<T>();
}
}
diff --git a/test/transform/resource/after-ecj/BuilderCustomName.java b/test/transform/resource/after-ecj/BuilderCustomName.java
new file mode 100644
index 00000000..1067a9d1
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderCustomName.java
@@ -0,0 +1,37 @@
+import java.util.List;
+@lombok.experimental.SuperBuilder class BuilderCustomName<T> {
+ public static abstract @java.lang.SuppressWarnings("all") class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> {
+ private @java.lang.SuppressWarnings("all") int field;
+ public SimpleTestBuilder() {
+ super();
+ }
+ protected abstract @java.lang.SuppressWarnings("all") B self();
+ public abstract @java.lang.SuppressWarnings("all") C build();
+ public @java.lang.SuppressWarnings("all") B field(final int field) {
+ this.field = field;
+ return self();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderCustomName.SimpleTestBuilder(field=" + this.field) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> {
+ private SimpleTestBuilderImpl() {
+ super();
+ }
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") SimpleTestBuilderImpl<T> self() {
+ return this;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") BuilderCustomName<T> build() {
+ return new BuilderCustomName<T>(this);
+ }
+ }
+ private final int field;
+ protected @java.lang.SuppressWarnings("all") BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) {
+ super();
+ this.field = b.field;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>SimpleTestBuilder<T, ?, ?> builder() {
+ return new SimpleTestBuilderImpl<T>();
+ }
+}
diff --git a/test/transform/resource/before/BuilderComplex.java b/test/transform/resource/before/BuilderComplex.java
index c13f5877..46f62721 100644
--- a/test/transform/resource/before/BuilderComplex.java
+++ b/test/transform/resource/before/BuilderComplex.java
@@ -1,3 +1,4 @@
+//CONF: lombok.builder.className = Test*Name
import java.util.List;
import lombok.Builder;
diff --git a/test/transform/resource/before/BuilderCustomName.java b/test/transform/resource/before/BuilderCustomName.java
new file mode 100644
index 00000000..d5709e63
--- /dev/null
+++ b/test/transform/resource/before/BuilderCustomName.java
@@ -0,0 +1,7 @@
+//CONF: lombok.builder.className = SimpleTestBuilder
+import java.util.List;
+
+@lombok.experimental.SuperBuilder
+class BuilderCustomName<T> {
+ private final int field;
+}
diff --git a/test/transform/resource/before/BuilderJavadoc.java b/test/transform/resource/before/BuilderJavadoc.java
index c2e0a6e0..390e2096 100644
--- a/test/transform/resource/before/BuilderJavadoc.java
+++ b/test/transform/resource/before/BuilderJavadoc.java
@@ -4,7 +4,7 @@ import java.util.List;
class BuilderJavadoc<T> {
/**
* basic gets only a builder setter.
- * @see #getsetwith
+ * @see #getsetwith
* @param tag is moved to the setter.
* @return tag is removed from the setter.
*/
@@ -49,6 +49,5 @@ class BuilderJavadoc<T> {
this.predefWithJavadoc = x * 100;
return this;
}
- }
-
+ }
}
diff --git a/website/templates/features/Builder.html b/website/templates/features/Builder.html
index 4fe416ee..af1ffd3a 100644
--- a/website/templates/features/Builder.html
+++ b/website/templates/features/Builder.html
@@ -160,6 +160,10 @@ public class JacksonExample {
<@f.confKeys>
<dt>
+ <code>lombok.builder.className</code> = [a java identifier with an optional star to indicate where the return type name goes] (default: <code>*Builder</code>)
+ </dt><dd>
+ Unless you explicitly pick the builder's class name with the <code>builderClassName</code> parameter, this name is chosen; any star in the name is replaced with the relevant return type.
+ </dd><dt>
<code>lombok.builder.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Lombok will flag any usage of <code>@Builder</code> as a warning or error if configured.
diff --git a/website/templates/features/experimental/SuperBuilder.html b/website/templates/features/experimental/SuperBuilder.html
index c68e28ca..5676b60c 100644
--- a/website/templates/features/experimental/SuperBuilder.html
+++ b/website/templates/features/experimental/SuperBuilder.html
@@ -52,6 +52,10 @@
<@f.confKeys>
<dt>
+ <code>lombok.builder.className</code> = [a java identifier with an optional star to indicate where the return type name goes] (default: <code>*Builder</code>)
+ </dt><dd>
+ This is the name of the generated builder class; any star in the name is replaced with the relevant return type. Note that the parent class must also have the same setting (the entire type hierarchy annoated with <code>@SuperBuilder</code> needs the same setting).
+ </dd><dt>
<code>lombok.superBuilder.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Lombok will flag any usage of <code>@SuperBuilder</code> as a warning or error if configured.