diff options
author | Emil Lundberg <emil@emlun.se> | 2019-01-10 04:50:38 +0100 |
---|---|---|
committer | Emil Lundberg <emil@emlun.se> | 2019-01-13 02:26:56 +0100 |
commit | 1eaa6da81602ddfd7d2d170974c064b8c0b117cf (patch) | |
tree | 0ff45f2768fcfb16fb23f2648ca559cb693ff068 /src/core/lombok/javac | |
parent | 452f1cb8eb11ab6335cc631e30c9ab21f9717140 (diff) | |
download | lombok-1eaa6da81602ddfd7d2d170974c064b8c0b117cf.tar.gz lombok-1eaa6da81602ddfd7d2d170974c064b8c0b117cf.tar.bz2 lombok-1eaa6da81602ddfd7d2d170974c064b8c0b117cf.zip |
Inline finishAndInjectSingularMethod into generateSingularMethod
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacSingularsRecipes.java | 18 |
1 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 12dd0bf8..db03c77a 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -267,7 +267,13 @@ public class JavacSingularsRecipes { void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) { ListBuffer<JCStatement> statements = generateSingularMethodStatements(maker, data, builderType, source); List<JCVariableDecl> params = generateSingularMethodParameters(maker, data, builderType, source); - finishAndInjectSingularMethod(maker, returnType, returnStatement, data, builderType, source, fluent, deprecate, statements, params, getAddMethodName()); + JCModifiers mods = makeMods(maker, builderType, deprecate); + if (returnStatement != null) statements.append(returnStatement); + JCBlock body = maker.Block(0, statements.toList()); + Name name = data.getSingularName(); + if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(getAddMethodName(), name.toString())); + + finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, params); } protected JCVariableDecl generateSingularMethodParameter(int typeIndex, JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source, Name name) { @@ -285,16 +291,6 @@ public class JavacSingularsRecipes { return maker.Exec(invokeAdd); } - protected void finishAndInjectSingularMethod(JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent, boolean deprecate, ListBuffer<JCStatement> statements, List<JCVariableDecl> params, String addMethodName) { - JCModifiers mods = makeMods(maker, builderType, deprecate); - if (returnStatement != null) statements.append(returnStatement); - JCBlock body = maker.Block(0, statements.toList()); - Name name = data.getSingularName(); - if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName(addMethodName, name.toString())); - - finishAndInjectMethod(maker, returnType, builderType, source, mods, body, name, params); - } - protected abstract ListBuffer<JCStatement> generateSingularMethodStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source); protected abstract List<JCVariableDecl> generateSingularMethodParameters(JavacTreeMaker maker, SingularData data, JavacNode builderType, JCTree source); |