diff options
author | Emil Lundberg <emil@emlun.se> | 2019-01-10 02:35:30 +0100 |
---|---|---|
committer | Emil Lundberg <emil@emlun.se> | 2019-01-13 02:13:56 +0100 |
commit | 360c1d5a21273793ef5c96c21b979501bdebb5c3 (patch) | |
tree | 62a02d16fc78ed8a88d8f6d850ffae78263ab966 /src/core/lombok | |
parent | bb7b5cce75988b0d774152a6f4d7b56ac1ab3953 (diff) | |
download | lombok-360c1d5a21273793ef5c96c21b979501bdebb5c3.tar.gz lombok-360c1d5a21273793ef5c96c21b979501bdebb5c3.tar.bz2 lombok-360c1d5a21273793ef5c96c21b979501bdebb5c3.zip |
Move invariant parameters inside finishAndInjectMethod
Diffstat (limited to 'src/core/lombok')
4 files changed, 10 insertions, 21 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index 6391c66c..9921ba89 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -241,7 +241,9 @@ public class JavacSingularsRecipes { generateClearMethod(deprecate, maker, returnTypeMaker.make(), returnStatementMaker.make(), data, builderType, source); } - protected void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JavacNode builderType, JCTree source, List<JCTypeParameter> typeParams, List<JCExpression> thrown, JCModifiers mods, JCBlock body, Name methodName, List<JCVariableDecl> jcVariableDecls) { + protected void finishAndInjectMethod(JavacTreeMaker maker, JCExpression returnType, JavacNode builderType, JCTree source, JCModifiers mods, JCBlock body, Name methodName, List<JCVariableDecl> jcVariableDecls) { + List<JCTypeParameter> typeParams = List.nil(); + List<JCExpression> thrown = List.nil(); JCMethodDecl method = maker.MethodDef(mods, methodName, returnType, typeParams, jcVariableDecls, thrown, body, null); recursiveSetGeneratedBy(method, source, builderType.getContext()); injectMethod(builderType, method); @@ -257,9 +259,7 @@ public class JavacSingularsRecipes { JCBlock body = maker.Block(0, statements); Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString())); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, thrown, mods, body, methodName, params); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, methodName, params); } protected abstract JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType); diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index 9141482f..b514ebd5 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -117,9 +117,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { params.append(p); } - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, thrown, mods, body, methodName, params.toList()); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, methodName, params.toList()); } @Override @@ -144,9 +142,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); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, thrown, mods, body, methodName, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, mods, 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 ba73d392..1b661bb2 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java @@ -116,9 +116,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize paramType = removeTypeUseAnnotations(paramType); JCModifiers paramMods = typeUseAnns.isEmpty() ? maker.Modifiers(paramFlags) : maker.Modifiers(paramFlags, typeUseAnns); JCVariableDecl param = maker.VarDef(paramMods, data.getSingularName(), paramType, null); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, thrown, mods, body, name, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, List.of(param)); } @Override @@ -137,8 +135,6 @@ 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); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, thrown, mods, body, name, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, List.of(param)); } } diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java index fe0db83e..c7483be6 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java @@ -159,9 +159,7 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer { JCModifiers paramModsValue = typeUseAnnsValue.isEmpty() ? maker.Modifiers(paramFlags) : maker.Modifiers(paramFlags, typeUseAnnsValue); JCVariableDecl paramKey = maker.VarDef(paramModsKey, keyName, paramTypeKey, null); JCVariableDecl paramValue = maker.VarDef(paramModsValue, valueName, paramTypeValue, null); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, thrown, mods, body, name, List.of(paramKey, paramValue)); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, List.of(paramKey, paramValue)); } @Override @@ -192,8 +190,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); - List<JCTypeParameter> typeParams = List.nil(); - finishAndInjectMethod(maker, returnType, builderType, source, typeParams, jceBlank, mods, body, name, List.of(param)); + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, List.of(param)); } @Override public void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName, String builderVariable) { |