aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/singulars
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2019-01-10 05:19:35 +0100
committerEmil Lundberg <emil@emlun.se>2019-01-13 02:26:56 +0100
commitc502090813dcbe73617643f8affebcc776a6dd6c (patch)
treee02858187b75976c4e8fc1b7e4aa75774c746515 /src/core/lombok/javac/handlers/singulars
parent749b8a5d1472ff49ca2ad5219d0c7f5f0b98d6a3 (diff)
downloadlombok-c502090813dcbe73617643f8affebcc776a6dd6c.tar.gz
lombok-c502090813dcbe73617643f8affebcc776a6dd6c.tar.bz2
lombok-c502090813dcbe73617643f8affebcc776a6dd6c.zip
Extract method getTypeArgumentsCount
Diffstat (limited to 'src/core/lombok/javac/handlers/singulars')
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java6
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
index e870142c..652e63f3 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
@@ -123,7 +123,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
Name name = data.getPluralName();
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("addAll", name.toString()));
JCExpression paramType = getPluralMethodParamType(builderType);
- paramType = addTypeArgs(1, true, builderType, paramType, data.getTypeArgs(), source);
+ 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);
finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, List.of(param));
@@ -137,4 +137,8 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
protected String getAddMethodName() {
return "add";
}
+
+ private int getTypeArgumentsCount() {
+ return 1;
+ }
}
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
index 94938288..4bef2f1d 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
@@ -170,7 +170,7 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
Name name = data.getPluralName();
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("putAll", name.toString()));
JCExpression paramType = getPluralMethodParamType(builderType);
- paramType = addTypeArgs(2, true, builderType, paramType, data.getTypeArgs(), source);
+ 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);
finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, List.of(param));
@@ -199,4 +199,8 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
protected String getAddMethodName() {
return "put";
}
+
+ private int getTypeArgumentsCount() {
+ return 2;
+ }
}