aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-02-08 22:53:19 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-02-08 22:53:19 +0100
commit2aff2159fcaf35c2cda4f837c5ceb65318b81db9 (patch)
treeca065af7e33a2b2220540de7dc0a01f02e9207eb
parent855f9314d621327de3321e2e5bf230e33fb7b1dc (diff)
downloadlombok-2aff2159fcaf35c2cda4f837c5ceb65318b81db9.tar.gz
lombok-2aff2159fcaf35c2cda4f837c5ceb65318b81db9.tar.bz2
lombok-2aff2159fcaf35c2cda4f837c5ceb65318b81db9.zip
marking generated fields in builders as generated. This seems superfluous as the entire builder class is marked as such, but it won’t be if that part is manually written but builder is supposed to fill in a few blanks.
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java4
-rw-r--r--src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java2
-rw-r--r--src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java2
-rw-r--r--src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java4
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java4
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java2
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java2
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java4
9 files changed, 14 insertions, 14 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index 45f4342e..c1b0d8a3 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -273,7 +273,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
cleanDecl.modifiers = ClassFileConstants.AccPrivate;
cleanDecl.type = TypeReference.baseTypeReference(TypeIds.T_boolean, 0);
System.out.println("INJECTING: cleaning");
- injectField(builderType, cleanDecl);
+ injectFieldAndMarkGenerated(builderType, cleanDecl);
}
if (constructorExists(builderType) == MemberExistsResult.NOT_EXISTS) {
@@ -444,7 +444,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
fd.modifiers = ClassFileConstants.AccPrivate;
fd.type = copyType(bfd.type);
fd.traverse(new SetGeneratedByVisitor(source), (MethodScope) null);
- bfd.createdFields.add(injectField(builderType, fd));
+ bfd.createdFields.add(injectFieldAndMarkGenerated(builderType, fd));
}
}
}
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
index 3b2ca875..fa121328 100644
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java
@@ -98,7 +98,7 @@ abstract class EclipseGuavaSingularizer extends EclipseSingularizer {
buildField.declarationSourceEnd = -1;
buildField.type = type;
data.setGeneratedByRecursive(buildField);
- return Collections.singletonList(injectField(builderType, buildField));
+ return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField));
}
@Override public void generateMethods(SingularData data, EclipseNode builderType, boolean fluent, boolean chain) {
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java
index 1d1c4dbd..4b59f7a8 100644
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilListSetSingularizer.java
@@ -80,7 +80,7 @@ abstract class EclipseJavaUtilListSetSingularizer extends EclipseJavaUtilSingula
buildField.declarationSourceEnd = -1;
buildField.type = type;
data.setGeneratedByRecursive(buildField);
- return Collections.singletonList(injectField(builderType, buildField));
+ return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField));
}
@Override public void generateMethods(SingularData data, EclipseNode builderType, boolean fluent, boolean chain) {
diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
index 640bd396..1c6b1ff3 100644
--- a/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
+++ b/src/core/lombok/eclipse/handlers/singulars/EclipseJavaUtilMapSingularizer.java
@@ -123,8 +123,8 @@ public class EclipseJavaUtilMapSingularizer extends EclipseJavaUtilSingularizer
}
data.setGeneratedByRecursive(buildKeyField);
data.setGeneratedByRecursive(buildValueField);
- EclipseNode keyFieldNode = injectField(builderType, buildKeyField);
- EclipseNode valueFieldNode = injectField(builderType, buildValueField);
+ EclipseNode keyFieldNode = injectFieldAndMarkGenerated(builderType, buildKeyField);
+ EclipseNode valueFieldNode = injectFieldAndMarkGenerated(builderType, buildValueField);
return Arrays.asList(keyFieldNode, valueFieldNode);
}
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index 4f7f79d9..30fec45b 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -252,7 +252,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
if (addCleaning) {
JavacTreeMaker maker = builderType.getTreeMaker();
JCVariableDecl uncleanField = maker.VarDef(maker.Modifiers(Flags.PRIVATE), builderType.toName("$lombokUnclean"), maker.TypeIdent(CTC_BOOLEAN), null);
- injectField(builderType, uncleanField);
+ injectFieldAndMarkGenerated(builderType, uncleanField);
}
if (constructorExists(builderType) == MemberExistsResult.NOT_EXISTS) {
@@ -405,7 +405,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
JavacTreeMaker maker = builderType.getTreeMaker();
JCModifiers mods = maker.Modifiers(Flags.PRIVATE);
JCVariableDecl newField = maker.VarDef(mods, bfd.name, cloneType(maker, bfd.type, source, builderType.getContext()), null);
- bfd.createdFields.add(injectField(builderType, newField));
+ bfd.createdFields.add(injectFieldAndMarkGenerated(builderType, newField));
}
}
}
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index a073ac0d..0db59da1 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -817,8 +817,8 @@ public class JavacHandlerUtil {
* The field carries the &#64;{@link SuppressWarnings}("all") annotation.
* Also takes care of updating the JavacAST.
*/
- public static void injectFieldAndMarkGenerated(JavacNode typeNode, JCVariableDecl field) {
- injectField(typeNode, field, true);
+ public static JavacNode injectFieldAndMarkGenerated(JavacNode typeNode, JCVariableDecl field) {
+ return injectField(typeNode, field, true);
}
/**
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
index e23837dc..41e379f6 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
@@ -66,7 +66,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer {
type = addTypeArgs(isMap() ? 2 : 1, false, builderType, type, data.getTypeArgs(), source);
JCVariableDecl buildField = maker.VarDef(maker.Modifiers(Flags.PRIVATE), data.getPluralName(), type, null);
- return Collections.singletonList(injectField(builderType, buildField));
+ return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField));
}
@Override public void generateMethods(SingularData data, JavacNode builderType, JCTree source, boolean fluent, boolean chain) {
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
index 6f8ff705..8574ddbf 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
@@ -72,7 +72,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
type = addTypeArgs(1, false, builderType, type, data.getTypeArgs(), source);
JCVariableDecl buildField = maker.VarDef(maker.Modifiers(Flags.PRIVATE), data.getPluralName(), type, null);
- return Collections.singletonList(injectField(builderType, buildField));
+ return Collections.singletonList(injectFieldAndMarkGenerated(builderType, buildField));
}
@Override public void generateMethods(SingularData data, JavacNode builderType, JCTree source, boolean fluent, boolean chain) {
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
index ed91698d..0830c9c9 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
@@ -94,8 +94,8 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
buildValueField = maker.VarDef(maker.Modifiers(Flags.PRIVATE), builderType.toName(data.getPluralName() + "$value"), type, null);
}
- JavacNode valueFieldNode = injectField(builderType, buildValueField);
- JavacNode keyFieldNode = injectField(builderType, buildKeyField);
+ JavacNode valueFieldNode = injectFieldAndMarkGenerated(builderType, buildValueField);
+ JavacNode keyFieldNode = injectFieldAndMarkGenerated(builderType, buildKeyField);
return Arrays.asList(keyFieldNode, valueFieldNode);
}