aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2019-01-10 05:56:52 +0100
committerEmil Lundberg <emil@emlun.se>2019-01-13 02:38:10 +0100
commit4c93fcb9fa3c7d4c026fffb4becb6beb7cc508a5 (patch)
tree4172ba92d3aa13d12f79edca806a39732feed21e
parentad4cc0f1831136d1836335020582b0adf6d801a6 (diff)
downloadlombok-4c93fcb9fa3c7d4c026fffb4becb6beb7cc508a5.tar.gz
lombok-4c93fcb9fa3c7d4c026fffb4becb6beb7cc508a5.tar.bz2
lombok-4c93fcb9fa3c7d4c026fffb4becb6beb7cc508a5.zip
Build statements list in generateClearMethod in the same way as in sibling methods
-rw-r--r--src/core/lombok/javac/handlers/JavacSingularsRecipes.java6
1 files changed, 4 insertions, 2 deletions
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<JCStatement> statements = returnStatement != null ? List.of(clearStatement, returnStatement) : List.of(clearStatement);
+ ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
+ 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.<JCVariableDecl>nil());
}