diff options
3 files changed, 12 insertions, 10 deletions
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index 4cd5cf46..7f610b79 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -103,15 +103,16 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { JCStatement st = maker.Exec(invokeAdd); statements.append(st); - if (returnStatement != null) statements.append(returnStatement); - JCBlock body = maker.Block(0, statements.toList()); - Name methodName = data.getSingularName(); - if (!fluent) methodName = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), methodName.toString())); ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>(); for (int i = 0; i < suffixes.size(); i++) { params.append(generateSingularMethodParameter(i, maker, data, builderType, source, names[i])); } + if (returnStatement != null) statements.append(returnStatement); + JCBlock body = maker.Block(0, statements.toList()); + Name methodName = data.getSingularName(); + if (!fluent) methodName = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), methodName.toString())); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, methodName, params.toList()); } diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java index 6beebec7..441f9eda 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java @@ -103,13 +103,14 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, false, source)); statements.append(generateSingularMethodAddStatement(maker, builderType, data.getSingularName(), data.getPluralName().toString())); + JCVariableDecl param = generateSingularMethodParameter(0, maker, data, builderType, source, data.getSingularName()); + List<JCVariableDecl> params = List.of(param); + if (returnStatement != null) statements.append(returnStatement); JCBlock body = maker.Block(0, statements.toList()); Name name = data.getSingularName(); if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("add", name.toString())); - JCVariableDecl param = generateSingularMethodParameter(0, maker, data, builderType, source, data.getSingularName()); - List<JCVariableDecl> params = List.of(param); finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, params); } diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java index cd98fd1e..5ecbee8a 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java @@ -137,15 +137,15 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer { /* Generates: this.pluralname$value.add(singularnameValue); */ statements.append(generateSingularMethodAddStatement(maker, builderType, valueName, data.getPluralName() + "$value")); + JCVariableDecl paramKey = generateSingularMethodParameter(0, maker, data, builderType, source, keyName); + JCVariableDecl paramValue = generateSingularMethodParameter(1, maker, data, builderType, source, valueName); + List<JCVariableDecl> params = List.of(paramKey, paramValue); + if (returnStatement != null) statements.append(returnStatement); JCBlock body = maker.Block(0, statements.toList()); - Name name = data.getSingularName(); if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("put", name.toString())); - JCVariableDecl paramKey = generateSingularMethodParameter(0, maker, data, builderType, source, keyName); - JCVariableDecl paramValue = generateSingularMethodParameter(1, maker, data, builderType, source, valueName); - List<JCVariableDecl> params = List.of(paramKey, paramValue); finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, params); } |