diff options
author | Jan Rieke <rieke@subshell.com> | 2017-03-14 18:47:29 +0100 |
---|---|---|
committer | Jan Rieke <rieke@subshell.com> | 2017-03-14 18:54:31 +0100 |
commit | e61561b5a587f9cc770902c3ad9532f0daa5b85f (patch) | |
tree | 8f8587a034ad77efe1ba5c04faf9961ee293b32f /src/core/lombok/javac/handlers/HandleBuilder.java | |
parent | e79022226b18fae8cb5e0864a405c8c7c5d4a559 (diff) | |
download | lombok-e61561b5a587f9cc770902c3ad9532f0daa5b85f.tar.gz lombok-e61561b5a587f9cc770902c3ad9532f0daa5b85f.tar.bz2 lombok-e61561b5a587f9cc770902c3ad9532f0daa5b85f.zip |
singularizer's build code for any variable name (not only "this")
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleBuilder.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleBuilder.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java index f46a95fd..42e76cf1 100644 --- a/src/core/lombok/javac/handlers/HandleBuilder.java +++ b/src/core/lombok/javac/handlers/HandleBuilder.java @@ -562,13 +562,16 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> { JCModifiers mods = maker.Modifiers(toJavacModifier(level), List.<JCAnnotation>nil()); - // Add ConstructorProperties - JCExpression constructorPropertiesType = chainDots(typeNode, "java", "beans", "ConstructorProperties"); - ListBuffer<JCExpression> fieldNames = new ListBuffer<JCExpression>(); - fieldNames.append(maker.Literal(builderVariableName.toString())); - JCExpression fieldNamesArray = maker.NewArray(null, List.<JCExpression>nil(), fieldNames.toList()); - JCAnnotation annotation = maker.Annotation(constructorPropertiesType, List.of(fieldNamesArray)); - mods.annotations = mods.annotations.append(annotation); + boolean suppressConstructorProperties = Boolean.TRUE.equals(typeNode.getAst().readConfiguration(ConfigurationKeys.ANY_CONSTRUCTOR_SUPPRESS_CONSTRUCTOR_PROPERTIES)); + if (!suppressConstructorProperties) { + // Add ConstructorProperties + JCExpression constructorPropertiesType = chainDots(typeNode, "java", "beans", "ConstructorProperties"); + ListBuffer<JCExpression> fieldNames = new ListBuffer<JCExpression>(); + fieldNames.append(maker.Literal(builderVariableName.toString())); + JCExpression fieldNamesArray = maker.NewArray(null, List.<JCExpression>nil(), fieldNames.toList()); + JCAnnotation annotation = maker.Annotation(constructorPropertiesType, List.of(fieldNamesArray)); + mods.annotations = mods.annotations.append(annotation); + } // Create a constructor that has just the builder as parameter. ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>(); |