From 7191aa78bde2072b86d4d3d99ad6a3dfb7fa6527 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 23 Jun 2009 23:52:34 +0200 Subject: fixed a bug where the auto-generated constructors (actual or static) would throw eclipse errors if you had 0 non-static fields. --- src/lombok/eclipse/handlers/HandleData.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lombok/eclipse/handlers') diff --git a/src/lombok/eclipse/handlers/HandleData.java b/src/lombok/eclipse/handlers/HandleData.java index 0b3dbffd..e90f33fd 100644 --- a/src/lombok/eclipse/handlers/HandleData.java +++ b/src/lombok/eclipse/handlers/HandleData.java @@ -215,8 +215,8 @@ public class HandleData implements EclipseAnnotationHandler { args.add(new Argument(field.name, fieldPos, copyType(field.type), 0)); } - constructor.statements = assigns.toArray(new Statement[assigns.size()]); - constructor.arguments = args.toArray(new Argument[args.size()]); + constructor.statements = assigns.isEmpty() ? null : assigns.toArray(new Statement[assigns.size()]); + constructor.arguments = args.isEmpty() ? null : args.toArray(new Argument[args.size()]); return constructor; } @@ -256,8 +256,8 @@ public class HandleData implements EclipseAnnotationHandler { args.add(new Argument(field.name, fieldPos, copyType(field.type), 0)); } - statement.arguments = assigns.toArray(new Expression[assigns.size()]); - constructor.arguments = args.toArray(new Argument[args.size()]); + statement.arguments = assigns.isEmpty() ? null : assigns.toArray(new Expression[assigns.size()]); + constructor.arguments = args.isEmpty() ? null : args.toArray(new Argument[args.size()]); constructor.statements = new Statement[] { new ReturnStatement(statement, (int)(p >> 32), (int)p) }; return constructor; } -- cgit