aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/javac/handlers/JavacSingularsRecipes.java5
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java6
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java5
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java5
4 files changed, 9 insertions, 12 deletions
diff --git a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
index 765d7e43..eed21af4 100644
--- a/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
+++ b/src/core/lombok/javac/handlers/JavacSingularsRecipes.java
@@ -248,7 +248,8 @@ public class JavacSingularsRecipes {
List<JCExpression> thrown = List.nil();
List<JCVariableDecl> params = List.nil();
- List<JCStatement> statements = generateClearStatements(maker, returnStatement, data, builderType);
+ JCStatement clearStatement = generateClearStatements(maker, data, builderType);
+ List<JCStatement> statements = returnStatement != null ? List.of(clearStatement, returnStatement) : List.of(clearStatement);
JCBlock body = maker.Block(0, statements);
Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString()));
@@ -257,7 +258,7 @@ public class JavacSingularsRecipes {
injectMethod(builderType, method);
}
- protected abstract List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType);
+ protected abstract JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType);
protected abstract void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent);
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
index d6796d51..6c60798d 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
@@ -77,11 +77,9 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer {
}
@Override
- protected List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType) {
+ protected JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType) {
JCExpression thisDotField = maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName());
-
- JCStatement clearField = maker.Exec(maker.Assign(thisDotField, maker.Literal(CTC_BOT, null)));
- return returnStatement != null ? List.of(clearField, returnStatement) : List.of(clearField);
+ return maker.Exec(maker.Assign(thisDotField, maker.Literal(CTC_BOT, null)));
}
@Override
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
index 9ecdbbaf..d07355c9 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
@@ -88,7 +88,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
}
@Override
- protected List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType) {
+ protected JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType) {
List<JCExpression> jceBlank = List.nil();
JCExpression thisDotField = maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName());
JCExpression thisDotFieldDotClear = maker.Select(maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName()), builderType.toName("clear"));
@@ -96,8 +96,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
JCStatement clearCall = maker.Exec(maker.Apply(jceBlank, thisDotFieldDotClear, jceBlank));
JCExpression cond = maker.Binary(CTC_NOT_EQUAL, thisDotField, maker.Literal(CTC_BOT, null));
- JCStatement ifSetCallClear = maker.If(cond, clearCall, null);
- return returnStatement != null ? List.of(ifSetCallClear, returnStatement) : List.of(ifSetCallClear);
+ return maker.If(cond, clearCall, null);
}
@Override
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
index ecd01aa3..fce0ccb9 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
@@ -113,7 +113,7 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
}
@Override
- protected List<JCStatement> generateClearStatements(JavacTreeMaker maker, JCStatement returnStatement, SingularData data, JavacNode builderType) {
+ protected JCStatement generateClearStatements(JavacTreeMaker maker, SingularData data, JavacNode builderType) {
List<JCExpression> jceBlank = List.nil();
JCExpression thisDotKeyField = chainDots(builderType, "this", data.getPluralName() + "$key");
@@ -123,8 +123,7 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
JCStatement clearValueCall = maker.Exec(maker.Apply(jceBlank, thisDotValueFieldDotClear, jceBlank));
JCExpression cond = maker.Binary(CTC_NOT_EQUAL, thisDotKeyField, maker.Literal(CTC_BOT, null));
JCBlock clearCalls = maker.Block(0, List.of(clearKeyCall, clearValueCall));
- JCStatement ifSetCallClear = maker.If(cond, clearCalls, null);
- return returnStatement != null ? List.of(ifSetCallClear, returnStatement) : List.of(ifSetCallClear);
+ return maker.If(cond, clearCalls, null);
}
@Override