From 4c93fcb9fa3c7d4c026fffb4becb6beb7cc508a5 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 10 Jan 2019 05:56:52 +0100 Subject: Build statements list in generateClearMethod in the same way as in sibling methods --- src/core/lombok/javac/handlers/JavacSingularsRecipes.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core/lombok') diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java index 0cfeaf4d..e169e2f9 100644 --- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java +++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java @@ -252,10 +252,12 @@ public class JavacSingularsRecipes { void generateClearMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) { JCStatement clearStatement = generateClearStatements(maker, data, builderType); - List statements = returnStatement != null ? List.of(clearStatement, returnStatement) : List.of(clearStatement); + ListBuffer statements = new ListBuffer(); + statements.add(clearStatement); + if (returnStatement != null) statements.append(returnStatement); Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString())); - JCBlock body = maker.Block(0, statements); + JCBlock body = maker.Block(0, statements.toList()); finishAndInjectMethod(maker, returnType, builderType, source, deprecate, body, methodName, List.nil()); } -- cgit