From 223a3fdb97ce67247b03a2537f53600fa6f2c383 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 10 Jan 2019 04:31:57 +0100 Subject: Uae names.length instead of suffixes.size() as loop limits --- .../lombok/javac/handlers/singulars/JavacGuavaSingularizer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/lombok/javac') diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index 9d5264c4..d3db63ff 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -84,17 +84,17 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { protected void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) { LombokImmutableList suffixes = getArgumentSuffixes(); Name[] names = new Name[suffixes.size()]; - for (int i = 0; i < suffixes.size(); i++) { + for (int i = 0; i < names.length; i++) { String s = suffixes.get(i); Name n = data.getSingularName(); names[i] = s.isEmpty() ? n : builderType.toName(s); } - + ListBuffer statements = new ListBuffer(); statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, source)); JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), getAddMethodName()); ListBuffer invokeAddExprBuilder = new ListBuffer(); - for (int i = 0; i < suffixes.size(); i++) { + for (int i = 0; i < names.length; i++) { invokeAddExprBuilder.append(maker.Ident(names[i])); } List invokeAddExpr = invokeAddExprBuilder.toList(); @@ -103,7 +103,7 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer { statements.append(st); ListBuffer params = new ListBuffer(); - for (int i = 0; i < suffixes.size(); i++) { + for (int i = 0; i < names.length; i++) { params.append(generateSingularMethodParameter(i, maker, data, builderType, source, names[i])); } -- cgit