From 07e4a3d4cac3e173d61ae49b267e7a87939d9104 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 10 Jan 2019 05:59:25 +0100 Subject: Move return statement addition statement to just before finishAndInjectMethod call --- src/core/lombok/javac/handlers/JavacSingularsRecipes.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index 5f6c4784..d8b53ab5 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -255,9 +255,9 @@ public class JavacSingularsRecipes { JCStatement clearStatement = generateClearStatements(maker, data, builderType); ListBuffer statements = new ListBuffer(); statements.add(clearStatement); - if (returnStatement != null) statements.append(returnStatement); 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.nil()); } @@ -266,10 +266,10 @@ public class JavacSingularsRecipes { void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) { ListBuffer statements = generateSingularMethodStatements(maker, data, builderType, source); List params = generateSingularMethodParameters(maker, data, builderType, source); - if (returnStatement != null) statements.append(returnStatement); 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); } @@ -294,13 +294,13 @@ public class JavacSingularsRecipes { void generatePluralMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) { ListBuffer statements = generatePluralMethodStatements(maker, data, builderType, source); - if (returnStatement != null) statements.append(returnStatement); Name name = data.getPluralName(); if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName() + "All", name.toString())); JCExpression paramType = getPluralMethodParamType(builderType); 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)); } -- cgit