aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java4
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleBuilder.java16
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleSuperBuilder.java6
3 files changed, 17 insertions, 9 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 257f5cec..463990d1 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -845,7 +845,6 @@ public class EclipseHandlerUtil {
}
public static TypeReference makeType(TypeBinding binding, ASTNode pos, boolean allowCompound) {
-
if (binding.getClass() == EclipseReflectiveMembers.INTERSECTION_BINDING) {
Object[] arr = (Object[]) EclipseReflectiveMembers.reflect(EclipseReflectiveMembers.INTERSECTION_BINDING_TYPES, binding);
binding = (TypeBinding) arr[0];
@@ -966,7 +965,8 @@ public class EclipseHandlerUtil {
// Finally, add however many nullTypeArgument[] arrays as that are missing, inverse the list, toArray it, and use that as PTR's typeArgument argument.
List<TypeReference[]> params = new ArrayList<TypeReference[]>();
- /* Calculate generics */ if(!(binding instanceof RawTypeBinding)) {
+ /* Calculate generics */
+ if (!(binding instanceof RawTypeBinding)) {
TypeBinding b = binding;
while (true) {
boolean isFinalStop = b.isLocalType() || !b.isMemberType() || b.enclosingType() == null;
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();