aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2019-01-10 05:42:58 +0100
committerEmil Lundberg <emil@emlun.se>2019-01-13 02:38:02 +0100
commit8059a4e383b2c2ebbb8b811d8bb45e5fac2e2d4c (patch)
treeb0db0a8e7b3bd2e144a511986de7dec182ae16a0 /src/core/lombok
parentbf43cb7cc4280bc9be67f1d1ac018c6d27d4cd39 (diff)
downloadlombok-8059a4e383b2c2ebbb8b811d8bb45e5fac2e2d4c.tar.gz
lombok-8059a4e383b2c2ebbb8b811d8bb45e5fac2e2d4c.tar.bz2
lombok-8059a4e383b2c2ebbb8b811d8bb45e5fac2e2d4c.zip
Merge finishAndInjectPluralMethod into generatePluralMethod
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/javac/handlers/JavacSingularsRecipes.java22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
index 96694fa4..058fa38a 100644
--- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
+++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
@@ -296,19 +296,6 @@ public class JavacSingularsRecipes {
void generatePluralMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) {
ListBuffer<JCStatement> statements = generatePluralMethodStatements(maker, data, builderType, source);
- finishAndInjectPluralMethod(deprecate, maker, returnType, returnStatement, data, builderType, source, fluent, statements);
- }
-
- protected ListBuffer<JCStatement> generatePluralMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source) {
- ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
- statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, source));
- JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), getAddMethodName() + "All");
- JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, List.<JCExpression>of(maker.Ident(data.getPluralName())));
- statements.append(maker.Exec(invokeAdd));
- return statements;
- }
-
- void finishAndInjectPluralMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent, ListBuffer<JCStatement> statements) {
if (returnStatement != null) statements.append(returnStatement);
JCBlock body = maker.Block(0, statements.toList());
Name name = data.getPluralName();
@@ -320,6 +307,15 @@ public class JavacSingularsRecipes {
finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, List.of(param));
}
+ protected ListBuffer<JCStatement> generatePluralMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source) {
+ ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
+ statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, source));
+ JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), getAddMethodName() + "All");
+ JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, List.<JCExpression>of(maker.Ident(data.getPluralName())));
+ statements.append(maker.Exec(invokeAdd));
+ return statements;
+ }
+
protected abstract JCExpression getPluralMethodParamType(JavacNode builderType);
protected abstract JCStatement createConstructBuilderVarIfNeeded(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source);