diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-02-08 22:53:19 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-02-08 22:53:19 +0100 |
commit | 2aff2159fcaf35c2cda4f837c5ceb65318b81db9 (patch) | |
tree | ca065af7e33a2b2220540de7dc0a01f02e9207eb /src/core/lombok/javac | |
parent | 855f9314d621327de3321e2e5bf230e33fb7b1dc (diff) | |
download | lombok-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.
Diffstat (limited to 'src/core/lombok/javac')
5 files changed, 8 insertions, 8 deletions
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 @{@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); } |