diff options
author | Emil Lundberg <emil@emlun.se> | 2019-01-10 06:00:35 +0100 |
---|---|---|
committer | Emil Lundberg <emil@emlun.se> | 2019-01-13 02:38:11 +0100 |
commit | 87bb89177c1ea0e1fb3e757d5d3c6d90f475ad7f (patch) | |
tree | f9a3155b26c344118434426ecd573fa598b2a899 /src/core/lombok | |
parent | 07e4a3d4cac3e173d61ae49b267e7a87939d9104 (diff) | |
download | lombok-87bb89177c1ea0e1fb3e757d5d3c6d90f475ad7f.tar.gz lombok-87bb89177c1ea0e1fb3e757d5d3c6d90f475ad7f.tar.bz2 lombok-87bb89177c1ea0e1fb3e757d5d3c6d90f475ad7f.zip |
Move return statement addition statement inside finishAndInjectMethod
Diffstat (limited to 'src/core/lombok')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacSingularsRecipes.java | 12 |
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 d8b53ab5..5a5e7258 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, ListBuffer<JCStatement> statements, Name methodName, List<JCVariableDecl> jcVariableDecls) { + void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, JavacNode builderType, JCTree source, boolean deprecate, ListBuffer<JCStatement> statements, Name methodName, List<JCVariableDecl> jcVariableDecls) { + if (returnStatement != null) statements.append(returnStatement); JCBlock body = maker.Block(0, statements.toList()); JCModifiers mods = makeMods(maker, builderType, deprecate); List<JCTypeParameter> typeParams = List.nil(); @@ -257,8 +258,7 @@ public class JavacSingularsRecipes { statements.add(clearStatement); Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString())); - if (returnStatement != null) statements.append(returnStatement); - finishAndInjectMethod(maker, returnType, builderType, source, deprecate, statements, methodName, List.<JCVariableDecl>nil()); + finishAndInjectMethod(maker, returnType, returnStatement, builderType, source, deprecate, statements, methodName, List.<JCVariableDecl>nil()); } protected abstract JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType); @@ -269,8 +269,7 @@ public class JavacSingularsRecipes { Name name = data.getSingularName(); if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), name.toString())); - if (returnStatement != null) statements.append(returnStatement); - finishAndInjectMethod(maker, returnType, builderType, source, deprecate, statements, name, params); + finishAndInjectMethod(maker, returnType, returnStatement, builderType, source, deprecate, statements, name, params); } protected JCVariableDecl generateSingularMethodParameter(int typeIndex, JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source, Name name) { @@ -300,8 +299,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); - if (returnStatement != null) statements.append(returnStatement); - finishAndInjectMethod(maker, returnType, builderType, source, deprecate, statements, name, List.of(param)); + finishAndInjectMethod(maker, returnType, returnStatement, builderType, source, deprecate, statements, name, List.of(param)); } protected ListBuffer<JCStatement> generatePluralMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source) { |