diff options
author | Jan Rieke <rieke@subshell.com> | 2017-03-14 16:56:33 +0100 |
---|---|---|
committer | Jan Rieke <rieke@subshell.com> | 2017-03-14 16:56:33 +0100 |
commit | e79022226b18fae8cb5e0864a405c8c7c5d4a559 (patch) | |
tree | 5df44839e4fdbcf33b3ab02a69de78f85b3d6c85 /src/core/lombok/javac/handlers/JavacSingularsRecipes.java | |
parent | cd2e2f25690c46f01b876074682e87af369d15d3 (diff) | |
download | lombok-e79022226b18fae8cb5e0864a405c8c7c5d4a559.tar.gz lombok-e79022226b18fae8cb5e0864a405c8c7c5d4a559.tar.bz2 lombok-e79022226b18fae8cb5e0864a405c8c7c5d4a559.zip |
singularizer's build code for any variable name (not only "this")
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacSingularsRecipes.java')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacSingularsRecipes.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index c6d601bd..33501349 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -187,7 +187,7 @@ public class JavacSingularsRecipes { public abstract java.util.List<JavacNode> generateFields(SingularData data, JavacNode builderType, JCTree source); public abstract void generateMethods(SingularData data, JavacNode builderType, JCTree source, boolean fluent, boolean chain); - public abstract void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName); + public abstract void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName, String builderVariable); public boolean requiresCleaning() { try { @@ -266,9 +266,9 @@ public class JavacSingularsRecipes { return arguments.toList(); } - /** Generates 'this.<em>name</em>.size()' as an expression; if nullGuard is true, it's this.name == null ? 0 : this.name.size(). */ - protected JCExpression getSize(JavacTreeMaker maker, JavacNode builderType, Name name, boolean nullGuard, boolean parens) { - Name thisName = builderType.toName("this"); + /** Generates '<em>builderVariable</em>.<em>name</em>.size()' as an expression; if nullGuard is true, it's this.name == null ? 0 : this.name.size(). */ + protected JCExpression getSize(JavacTreeMaker maker, JavacNode builderType, Name name, boolean nullGuard, boolean parens, String builderVariable) { + Name thisName = builderType.toName(builderVariable); JCExpression fn = maker.Select(maker.Select(maker.Ident(thisName), name), builderType.toName("size")); JCExpression sizeInvoke = maker.Apply(List.<JCExpression>nil(), fn, List.<JCExpression>nil()); if (nullGuard) { |