diff options
author | Emil Lundberg <emil@emlun.se> | 2019-01-10 05:03:17 +0100 |
---|---|---|
committer | Emil Lundberg <emil@emlun.se> | 2019-01-13 02:26:56 +0100 |
commit | fe143bfd69f70749f4e745c5be6644c37840083f (patch) | |
tree | 900dac579c9d40bb13b6d6f3eda157f987c9eacc | |
parent | 36653329e51cd478199a2d74da6ec5ee471d9cac (diff) | |
download | lombok-fe143bfd69f70749f4e745c5be6644c37840083f.tar.gz lombok-fe143bfd69f70749f4e745c5be6644c37840083f.tar.bz2 lombok-fe143bfd69f70749f4e745c5be6644c37840083f.zip |
Move invariant parameter inside finishAndInjectMethod
4 files changed, 7 insertions, 11 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index a32a64be..69eaf97c 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -241,7 +241,8 @@ public class JavacSingularsRecipes { generateClearMethod(deprecate, maker, returnTypeMaker.make(), returnStatementMaker.make(), data, builderType, source); } - protected void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JavacNode builderType, JCTree source, JCModifiers mods, JCBlock body, Name methodName, List<JCVariableDecl> jcVariableDecls) { + protected void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JavacNode builderType, JCTree source, boolean deprecate, JCBlock body, Name methodName, List<JCVariableDecl> jcVariableDecls) { + JCModifiers mods = makeMods(maker, builderType, deprecate); List<JCTypeParameter> typeParams = List.nil(); List<JCExpression> thrown = List.nil(); JCMethodDecl method = maker.MethodDef(mods, methodName, returnType, typeParams, jcVariableDecls, thrown, body, null); @@ -258,8 +259,7 @@ public class JavacSingularsRecipes { JCBlock body = maker.Block(0, statements); Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString())); - JCModifiers mods = makeMods(maker, builderType, deprecate); - finishAndInjectMethod(maker, returnType, builderType, source, mods, body, methodName, params); + finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, methodName, params); } protected abstract JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType); @@ -272,8 +272,7 @@ public class JavacSingularsRecipes { Name name = data.getSingularName(); if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), name.toString())); - JCModifiers mods = makeMods(maker, builderType, deprecate); - finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, params); + finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, params); } protected JCVariableDecl generateSingularMethodParameter(int typeIndex, JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source, Name name) { diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index c493e08f..53b5e416 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -139,8 +139,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { } paramType = addTypeArgs(getTypeArgumentsCount(), true, builderType, paramType, data.getTypeArgs(), source); JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null); - JCModifiers mods = makeMods(maker, builderType, deprecate); - finishAndInjectMethod(maker, returnType, builderType, source, mods, body, methodName, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, methodName, List.of(param)); } @Override public void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName, String builderVariable) { diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java index 0d88e662..51aaf3f7 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java @@ -125,8 +125,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize JCExpression paramType = chainDots(builderType, "java", "util", "Collection"); paramType = addTypeArgs(1, true, builderType, paramType, data.getTypeArgs(), source); JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null); - JCModifiers mods = makeMods(maker, builderType, deprecate); - finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, List.of(param)); } @Override diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java index f849203e..cbf61225 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java @@ -173,8 +173,7 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer { JCExpression paramType = chainDots(builderType, "java", "util", "Map"); paramType = addTypeArgs(2, true, builderType, paramType, data.getTypeArgs(), source); JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null); - JCModifiers mods = makeMods(maker, builderType, deprecate); - finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, name, List.of(param)); } @Override public void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName, String builderVariable) { |