diff options
author | Emil Lundberg <emil@emlun.se> | 2019-01-10 01:51:47 +0100 |
---|---|---|
committer | Emil Lundberg <emil@emlun.se> | 2019-01-13 02:13:54 +0100 |
commit | d08aa5a83d2302eaaf84c4323073dfe3edd43703 (patch) | |
tree | 4c4e651ce61ae92c8d987df21ffb33fce8664147 | |
parent | 05ce5e050ea15a7feb26ba2ef6f3cda9b54c8498 (diff) | |
download | lombok-d08aa5a83d2302eaaf84c4323073dfe3edd43703.tar.gz lombok-d08aa5a83d2302eaaf84c4323073dfe3edd43703.tar.bz2 lombok-d08aa5a83d2302eaaf84c4323073dfe3edd43703.zip |
Pull generateClearMethod up to JavacSingularizer
4 files changed, 8 insertions, 39 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index 1d4d5a8d..765d7e43 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -241,9 +241,15 @@ public class JavacSingularsRecipes { generateClearMethod(deprecate, maker, returnTypeMaker.make(), returnStatementMaker.make(), data, builderType, source); } - protected abstract void generateClearMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source); + protected void generateClearMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) { + JCModifiers mods = makeMods(maker, builderType, deprecate); + + List<JCTypeParameter> typeParams = List.nil(); + List<JCExpression> thrown = List.nil(); + List<JCVariableDecl> params = List.nil(); + + List<JCStatement> statements = generateClearStatements(maker, returnStatement, data, builderType); - protected void finishGenerateClearMethod(JavacTreeMaker maker, JCExpression returnType, SingularData data, JavacNode builderType, JCTree source, JCModifiers mods, List<JCTypeParameter> typeParams, List<JCExpression> thrown, List<JCVariableDecl> params, List<JCStatement> statements) { JCBlock body = maker.Block(0, statements); Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString())); JCMethodDecl method = maker.MethodDef(mods, methodName, returnType, typeParams, params, thrown, body, null); diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index 13a48869..d6796d51 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -77,18 +77,6 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { } @Override - protected void generateClearMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) { - JCModifiers mods = makeMods(maker, builderType, deprecate); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - List<JCVariableDecl> params = List.nil(); - - List<JCStatement> statements = generateClearStatements(maker, returnStatement, data, builderType); - - finishGenerateClearMethod(maker, returnType, data, builderType, source, mods, typeParams, thrown, params, statements); - } - - @Override protected List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType) { JCExpression thisDotField = maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName()); diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java index f332aad1..9ecdbbaf 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java @@ -88,18 +88,6 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize } @Override - protected void generateClearMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) { - JCModifiers mods = makeMods(maker, builderType, deprecate); - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - List<JCVariableDecl> params = List.nil(); - - List<JCStatement> statements = generateClearStatements(maker, returnStatement, data, builderType); - - finishGenerateClearMethod(maker, returnType, data, builderType, source, mods, typeParams, thrown, params, statements); - } - - @Override protected List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType) { List<JCExpression> jceBlank = List.nil(); JCExpression thisDotField = maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName()); diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java index dab09eb3..ecd01aa3 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java @@ -113,19 +113,6 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer { } @Override - protected void generateClearMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) { - JCModifiers mods = makeMods(maker, builderType, deprecate); - - List<JCTypeParameter> typeParams = List.nil(); - List<JCExpression> thrown = List.nil(); - List<JCVariableDecl> params = List.nil(); - - List<JCStatement> statements = generateClearStatements(maker, returnStatement, data, builderType); - - finishGenerateClearMethod(maker, returnType, data, builderType, source, mods, typeParams, thrown, params, statements); - } - - @Override protected List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType) { List<JCExpression> jceBlank = List.nil(); |