aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2016-11-22 00:49:40 +0100
committerGitHub <noreply@github.com>2016-11-22 00:49:40 +0100
commitcce6f39389f5890ac1df94cbb5553a101fb5a970 (patch)
treea0158694addf759eae1b0b6dbe385e8bcd49e71b
parentd6f1116108754152377cb1e0e276dedb7ffabbab (diff)
parentd317eda711f2b07bdbac15bc9652ae9816e4517b (diff)
downloadlombok-cce6f39389f5890ac1df94cbb5553a101fb5a970.tar.gz
lombok-cce6f39389f5890ac1df94cbb5553a101fb5a970.tar.bz2
lombok-cce6f39389f5890ac1df94cbb5553a101fb5a970.zip
Merge pull request #1231 from bulgakovalexander/bugfix/NoArgsConstructorForce
fix of the issue 1228
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java3
-rw-r--r--test/transform/resource/after-delombok/NoArgsConstructorForce.java14
-rw-r--r--test/transform/resource/after-ecj/NoArgsConstructorForce.java12
-rw-r--r--test/transform/resource/before/NoArgsConstructorForce.java8
4 files changed, 37 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 85d1d4ed..a3b0585d 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -48,6 +48,7 @@ import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
+import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
import org.eclipse.jdt.internal.compiler.ast.Assignment;
import org.eclipse.jdt.internal.compiler.ast.CharLiteral;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -381,6 +382,8 @@ public class HandleConstructor {
}
private static Expression getDefaultExpr(TypeReference type, int s, int e) {
+ boolean array = type instanceof ArrayTypeReference;
+ if (array) return new NullLiteral(s, e);
char[] lastToken = type.getLastToken();
if (Arrays.equals(TypeConstants.BOOLEAN, lastToken)) return new FalseLiteral(s, e);
if (Arrays.equals(TypeConstants.CHAR, lastToken)) return new CharLiteral(new char[] {'\'', '\\', '0', '\''}, s, e);
diff --git a/test/transform/resource/after-delombok/NoArgsConstructorForce.java b/test/transform/resource/after-delombok/NoArgsConstructorForce.java
new file mode 100644
index 00000000..c1127c7c
--- /dev/null
+++ b/test/transform/resource/after-delombok/NoArgsConstructorForce.java
@@ -0,0 +1,14 @@
+
+public class NoArgsConstructorForce {
+ private final int[] i;
+ private final Object[] o;
+ private final java.util.List<?>[] fullQualifiedList;
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public NoArgsConstructorForce() {
+ this.i = null;
+ this.o = null;
+ this.fullQualifiedList = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/NoArgsConstructorForce.java b/test/transform/resource/after-ecj/NoArgsConstructorForce.java
new file mode 100644
index 00000000..d0e69b0d
--- /dev/null
+++ b/test/transform/resource/after-ecj/NoArgsConstructorForce.java
@@ -0,0 +1,12 @@
+import lombok.NoArgsConstructor;
+public @NoArgsConstructor(force = true) class NoArgsConstructorForce {
+ private final int[] i;
+ private final Object[] o;
+ private final java.util.List<?>[] fullQualifiedList;
+ public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") NoArgsConstructorForce() {
+ super();
+ this.i = null;
+ this.o = null;
+ this.fullQualifiedList = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NoArgsConstructorForce.java b/test/transform/resource/before/NoArgsConstructorForce.java
new file mode 100644
index 00000000..48df1a37
--- /dev/null
+++ b/test/transform/resource/before/NoArgsConstructorForce.java
@@ -0,0 +1,8 @@
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(force = true)
+public class NoArgsConstructorForce {
+ private final int[] i;
+ private final Object[] o;
+ private final java.util.List<?>[] fullQualifiedList;
+} \ No newline at end of file