diff options
author | Robert Wertman <robert.wertman@gmail.com> | 2019-01-27 00:39:30 -0500 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2019-01-28 20:44:53 +0100 |
commit | f2d03973d59d96d8bfef51d8378a4069d8d46205 (patch) | |
tree | d3d75b5fbca4e64d5ee967f3ec90b547019e89fd /src/core/lombok/eclipse/handlers/HandleSuperBuilder.java | |
parent | ccd802503d8aa578be3f1f956d97b06a803de0aa (diff) | |
download | lombok-f2d03973d59d96d8bfef51d8378a4069d8d46205.tar.gz lombok-f2d03973d59d96d8bfef51d8378a4069d8d46205.tar.bz2 lombok-f2d03973d59d96d8bfef51d8378a4069d8d46205.zip |
Replace sized array in toArray with 0
This approach has been benchmarked to be marginally faster.
Fixes #2030.
Diffstat (limited to 'src/core/lombok/eclipse/handlers/HandleSuperBuilder.java')
-rwxr-xr-x[-rw-r--r--] | src/core/lombok/eclipse/handlers/HandleSuperBuilder.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java index 9a3275c2..7b6a3c28 100644..100755 --- a/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java @@ -546,7 +546,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> { } } - constructor.statements = statements.isEmpty() ? null : statements.toArray(new Statement[statements.size()]); + constructor.statements = statements.isEmpty() ? null : statements.toArray(new Statement[0]); constructor.traverse(new SetGeneratedByVisitor(source), typeDeclaration.scope); @@ -654,7 +654,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> { returnCall.selector = SELF_METHOD_NAME; body.add(new ReturnStatement(returnCall, 0, 0)); - out.statements = body.isEmpty() ? null : body.toArray(new Statement[body.size()]); + out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]); return out; } @@ -694,7 +694,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> { body.add(exec); } - out.statements = body.isEmpty() ? null : body.toArray(new Statement[body.size()]); + out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]); return out; } @@ -788,7 +788,7 @@ public class HandleSuperBuilder extends EclipseAnnotationHandler<SuperBuilder> { // Use a constructor that only has this builder as parameter. allocationStatement.arguments = new Expression[] {new ThisReference(0, 0)}; statements.add(new ReturnStatement(allocationStatement, 0, 0)); - out.statements = statements.isEmpty() ? null : statements.toArray(new Statement[statements.size()]); + out.statements = statements.isEmpty() ? null : statements.toArray(new Statement[0]); out.traverse(new SetGeneratedByVisitor(source), (ClassScope) null); return out; } |