aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2019-01-10 05:58:08 +0100
committerEmil Lundberg <emil@emlun.se>2019-01-13 02:38:10 +0100
commit691c855b8962ef78d38ebb6851f5a74b500beab4 (patch)
treefa659443f7d6e045681d9ff23bfece97b6a31a3a /src/core
parent4c93fcb9fa3c7d4c026fffb4becb6beb7cc508a5 (diff)
downloadlombok-691c855b8962ef78d38ebb6851f5a74b500beab4.tar.gz
lombok-691c855b8962ef78d38ebb6851f5a74b500beab4.tar.bz2
lombok-691c855b8962ef78d38ebb6851f5a74b500beab4.zip
Move invariant parameter inside finishAndInjectMethod
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/javac/handlers/JavacSingularsRecipes.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
index e169e2f9..5f6c4784 100644
--- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
+++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
@@ -241,7 +241,8 @@ public class JavacSingularsRecipes {
generateClearMethod(deprecate, maker, returnTypeMaker.make(), returnStatementMaker.make(), data, builderType, source);
}
- void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JavacNode builderType, JCTree source, boolean deprecate, JCBlock body, Name methodName, List<JCVariableDecl> jcVariableDecls) {
+ void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JavacNode builderType, JCTree source, boolean deprecate, ListBuffer<JCStatement> statements, Name methodName, List<JCVariableDecl> jcVariableDecls) {
+ JCBlock body = maker.Block(0, statements.toList());
JCModifiers mods = makeMods(maker, builderType, deprecate);
List<JCTypeParameter> typeParams = List.nil();
List<JCExpression> thrown = List.nil();
@@ -257,8 +258,7 @@ public class JavacSingularsRecipes {
if (returnStatement != null) statements.append(returnStatement);
Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString()));
- JCBlock body = maker.Block(0, statements.toList());
- finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, methodName, List.<JCVariableDecl>nil());
+ finishAndInjectMethod(maker, returnType, builderType, source, deprecate, statements, methodName, List.<JCVariableDecl>nil());
}
protected abstract JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType);
@@ -270,8 +270,7 @@ public class JavacSingularsRecipes {
Name name = data.getSingularName();
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), name.toString()));
- JCBlock body = maker.Block(0, statements.toList());
- finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, params);
+ finishAndInjectMethod(maker, returnType, builderType, source, deprecate, statements, name, params);
}
protected JCVariableDecl generateSingularMethodParameter(int typeIndex, JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source, Name name) {
@@ -302,8 +301,7 @@ public class JavacSingularsRecipes {
paramType = addTypeArgs(getTypeArgumentsCount(), true, builderType, paramType, data.getTypeArgs(), source);
long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext());
JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null);
- JCBlock body = maker.Block(0, statements.toList());
- finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, List.of(param));
+ finishAndInjectMethod(maker, returnType, builderType, source, deprecate, statements, name, List.of(param));
}
protected ListBuffer<JCStatement> generatePluralMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source) {