aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2019-01-10 04:10:29 +0100
committerEmil Lundberg <emil@emlun.se>2019-01-13 02:25:26 +0100
commita4c21e941d28160c33e6541a29350d23209cfb8f (patch)
tree87cf7c5d27fc93deff6b196204d005a3be42739e /src/core/lombok/javac/handlers
parentf995dd20360311f355e18bf5fa048058efecdd11 (diff)
downloadlombok-a4c21e941d28160c33e6541a29350d23209cfb8f.tar.gz
lombok-a4c21e941d28160c33e6541a29350d23209cfb8f.tar.bz2
lombok-a4c21e941d28160c33e6541a29350d23209cfb8f.zip
Make last few statements the same between generateSingularMethod implementations
Diffstat (limited to 'src/core/lombok/javac/handlers')
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java9
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java5
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java8
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);
}