aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Rieke <rieke@subshell.com>2022-07-15 13:04:31 +0200
committerJan Rieke <rieke@subshell.com>2022-07-15 13:04:31 +0200
commit588a4a88c19103670bffb4bcc81fc203379253e9 (patch)
tree70401ddf3e4a8d746d94ada01f8f3640c715c8c8 /src
parent1473389f397579a224d57b496f6387f3b8cbb6a9 (diff)
downloadlombok-588a4a88c19103670bffb4bcc81fc203379253e9.tar.gz
lombok-588a4a88c19103670bffb4bcc81fc203379253e9.tar.bz2
lombok-588a4a88c19103670bffb4bcc81fc203379253e9.zip
[fix #3230] switch setter and self/build methods to allow overloaded
self/build methods
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSuperBuilder.java11
-rw-r--r--src/core/lombok/javac/handlers/HandleSuperBuilder.java10
2 files changed, 10 insertions, 11 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
index 558c6ec2..9951d1ab 100644
--- a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
@@ -51,7 +51,6 @@ import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
import org.eclipse.jdt.internal.compiler.ast.IfStatement;
import org.eclipse.jdt.internal.compiler.ast.Initializer;
-import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
@@ -387,16 +386,16 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> {
injectMethod(job.builderType, generateStaticFillValuesMethod(job, annInstance.setterPrefix()));
}
- // Generate abstract self() and build() methods in the abstract builder.
- injectMethod(job.builderType, generateAbstractSelfMethod(job, superclassBuilderClass != null, builderGenericName));
- job.setBuilderToAbstract();
- injectMethod(job.builderType, generateAbstractBuildMethod(job, superclassBuilderClass != null, classGenericName));
-
// Create the setter methods in the abstract builder.
for (BuilderFieldData bfd : job.builderFields) {
generateSetterMethodsForBuilder(job, bfd, builderGenericName, annInstance.setterPrefix());
}
+ // Generate abstract self() and build() methods in the abstract builder.
+ injectMethod(job.builderType, generateAbstractSelfMethod(job, superclassBuilderClass != null, builderGenericName));
+ job.setBuilderToAbstract();
+ injectMethod(job.builderType, generateAbstractBuildMethod(job, superclassBuilderClass != null, classGenericName));
+
// Create the toString() method for the abstract builder.
if (methodExists("toString", job.builderType, 0) == MemberExistsResult.NOT_EXISTS) {
List<Included<EclipseNode, ToString.Include>> fieldNodes = new ArrayList<Included<EclipseNode, ToString.Include>>();
diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
index 7418ac87..3fb92525 100644
--- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
@@ -336,6 +336,11 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
injectMethod(job.builderType, sfvm);
}
+ // Create the setter methods in the abstract builder.
+ for (BuilderFieldData bfd : job.builderFields) {
+ generateSetterMethodsForBuilder(job, bfd, builderGenericName, annInstance.setterPrefix());
+ }
+
// Generate abstract self() and build() methods in the abstract builder.
JCMethodDecl asm = generateAbstractSelfMethod(job, superclassBuilderClass != null, builderGenericName);
recursiveSetGeneratedBy(asm, annotationNode);
@@ -344,11 +349,6 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
recursiveSetGeneratedBy(abm, annotationNode);
injectMethod(job.builderType, abm);
- // Create the setter methods in the abstract builder.
- for (BuilderFieldData bfd : job.builderFields) {
- generateSetterMethodsForBuilder(job, bfd, builderGenericName, annInstance.setterPrefix());
- }
-
// Create the toString() method for the abstract builder.
java.util.List<Included<JavacNode, ToString.Include>> fieldNodes = new ArrayList<Included<JavacNode, ToString.Include>>();
for (BuilderFieldData bfd : job.builderFields) {