aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/singulars
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2019-01-10 04:11:59 +0100
committerEmil Lundberg <emil@emlun.se>2019-01-13 02:25:26 +0100
commite8c70dd755c528b4f975be95333a337c290db2be (patch)
tree7c48a95c9c47b12cd89fee63c2ae61e9c70139e2 /src/core/lombok/javac/handlers/singulars
parenta4c21e941d28160c33e6541a29350d23209cfb8f (diff)
downloadlombok-e8c70dd755c528b4f975be95333a337c290db2be.tar.gz
lombok-e8c70dd755c528b4f975be95333a337c290db2be.tar.bz2
lombok-e8c70dd755c528b4f975be95333a337c290db2be.zip
Extract local variable addMethodName
Diffstat (limited to 'src/core/lombok/javac/handlers/singulars')
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java3
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java3
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
index 7f610b79..25fc8751 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
@@ -108,10 +108,11 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer {
params.append(generateSingularMethodParameter(i, maker, data, builderType, source, names[i]));
}
+ String addMethodName = getAddMethodName();
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()));
+ if (!fluent) methodName = builderType.toName(HandlerUtil.buildAccessorName(addMethodName, 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 441f9eda..981f40cd 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
@@ -106,10 +106,11 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
JCVariableDecl param = generateSingularMethodParameter(0, maker, data, builderType, source, data.getSingularName());
List<JCVariableDecl> params = List.of(param);
+ String addMethodName = "add";
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()));
+ if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(addMethodName, name.toString()));
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 5ecbee8a..a7859ce6 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
@@ -141,10 +141,11 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
JCVariableDecl paramValue = generateSingularMethodParameter(1, maker, data, builderType, source, valueName);
List<JCVariableDecl> params = List.of(paramKey, paramValue);
+ String addMethodName = "put";
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()));
+ if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(addMethodName, name.toString()));
finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, params);
}