From 36e6e56a93b783b3847d53e998c8e124475d8053 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 10 Jan 2019 04:00:09 +0100 Subject: Inline single-use variables --- .../handlers/singulars/JavacJavaUtilListSetSingularizer.java | 3 +-- .../handlers/singulars/JavacJavaUtilMapSingularizer.java | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'src/core/lombok/javac/handlers/singulars') diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java index 3781a67e..935edbc3 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java @@ -101,8 +101,7 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize JCModifiers mods = makeMods(maker, builderType, deprecate); ListBuffer statements = new ListBuffer(); statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, false, source)); - JCStatement st = generateSingularMethodAddStatement(maker, builderType, data.getSingularName(), data.getPluralName().toString()); - statements.append(st); + statements.append(generateSingularMethodAddStatement(maker, builderType, data.getSingularName(), data.getPluralName().toString())); if (returnStatement != null) statements.append(returnStatement); JCBlock body = maker.Block(0, statements.toList()); diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java index 16b5f1a0..f9a95095 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java @@ -131,14 +131,9 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer { statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, true, source)); Name keyName = builderType.toName(data.getSingularName().toString() + "Key"); Name valueName = builderType.toName(data.getSingularName().toString() + "Value"); - /* this.pluralname$key.add(singularnameKey); */ { - JCStatement st = generateSingularMethodAddStatement(maker, builderType, keyName, data.getPluralName() + "$key"); - statements.append(st); - } - /* this.pluralname$value.add(singularnameValue); */ { - JCStatement st = generateSingularMethodAddStatement(maker, builderType, valueName, data.getPluralName() + "$value"); - statements.append(st); - } + statements.append(generateSingularMethodAddStatement(maker, builderType, keyName, data.getPluralName() + "$key")); + statements.append(generateSingularMethodAddStatement(maker, builderType, valueName, data.getPluralName() + "$value")); + if (returnStatement != null) statements.append(returnStatement); JCBlock body = maker.Block(0, statements.toList()); -- cgit