From 73cd46fce20a2c859a6fa9b78d921ff935642223 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 15 Oct 2018 21:50:36 +0200 Subject: Fix up positions of generated nodes for eclipse `@Builder`. --- src/core/lombok/eclipse/handlers/HandleBuilder.java | 1 + .../lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java | 2 ++ .../handlers/singulars/EclipseJavaUtilListSetSingularizer.java | 4 +++- .../eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/core/lombok/eclipse/handlers') diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index e22b4ed2..89cf81e0 100644 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -445,6 +445,7 @@ public class HandleBuilder extends EclipseAnnotationHandler { cleanDecl.declarationSourceEnd = -1; cleanDecl.modifiers = ClassFileConstants.AccPrivate; cleanDecl.type = TypeReference.baseTypeReference(TypeIds.T_boolean, 0); + cleanDecl.traverse(new SetGeneratedByVisitor(ast), (MethodScope) null); injectFieldAndMarkGenerated(builderType, cleanDecl); } diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java index 17fc5e09..4b094a9f 100644 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java @@ -94,6 +94,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer { buildField.modifiers = ClassFileConstants.AccPrivate; buildField.declarationSourceEnd = -1; buildField.type = type; + data.setGeneratedByRecursive(buildField); return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField)); } @@ -117,6 +118,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer { md.returnType = returnType; md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null; + data.setGeneratedByRecursive(md); injectMethod(builderType, md); } diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java index c7315790..11314bd3 100644 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java @@ -85,6 +85,7 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula buildField.modifiers = ClassFileConstants.AccPrivate; buildField.declarationSourceEnd = -1; buildField.type = type; + data.setGeneratedByRecursive(buildField); return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField)); } @@ -117,6 +118,8 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula md.statements = returnStatement != null ? new Statement[] {clearStatement, returnStatement} : new Statement[] {clearStatement}; md.returnType = returnType; md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null; + + data.setGeneratedByRecursive(md); injectMethod(builderType, md); } @@ -149,7 +152,6 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null; data.setGeneratedByRecursive(md); - HandleNonNull.INSTANCE.fix(injectMethod(builderType, md)); } diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java index 174cd5fc..55f6cadd 100644 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java @@ -127,6 +127,7 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer buildValueField.declarationSourceEnd = -1; buildValueField.type = type; } + data.setGeneratedByRecursive(buildKeyField); data.setGeneratedByRecursive(buildValueField); EclipseNode keyFieldNode = injectFieldAndMarkGenerated(builderType, buildKeyField); @@ -174,6 +175,7 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer md.returnType = returnType; md.annotations = deprecate ? new Annotation[] { generateDeprecatedAnnotation(data.getSource()) } : null; + data.setGeneratedByRecursive(md); injectMethod(builderType, md); } -- cgit