aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2020-04-17 01:34:30 +0200
committerGitHub <noreply@github.com>2020-04-17 01:34:30 +0200
commit9d50e9f8ad16c463b6ff9dbb87fd7a012c68bfef (patch)
treef08b7027f30361f0b033b1e801b26a7e07f64dc4
parentd4e5eb004066720d235cba7e474af088b6b9ce85 (diff)
parentd34fdeb3b4b44aae8c03cee0d3b1dd35a3d74e31 (diff)
downloadlombok-9d50e9f8ad16c463b6ff9dbb87fd7a012c68bfef.tar.gz
lombok-9d50e9f8ad16c463b6ff9dbb87fd7a012c68bfef.tar.bz2
lombok-9d50e9f8ad16c463b6ff9dbb87fd7a012c68bfef.zip
Merge pull request #2427 from Rawi01/addNullCheck
Add null check in copyTypeAnns
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java8
-rw-r--r--test/transform/resource/after-delombok/TypeUseAnnotations.java10
-rw-r--r--test/transform/resource/after-ecj/TypeUseAnnotations.java9
-rw-r--r--test/transform/resource/before/TypeUseAnnotations.java2
4 files changed, 26 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 4df7a90b..2c6e1e77 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -660,9 +660,11 @@ public class EclipseHandlerUtil {
Annotation[][] b = new Annotation[a.length][];
for (int i = 0; i < a.length; i++) {
- b[i] = new Annotation[a[i].length];
- for (int j = 0 ; j < a[i].length; j++) {
- b[i][j] = copyAnnotation(a[i][j], a[i][j]);
+ if (a[i] != null) {
+ b[i] = new Annotation[a[i].length];
+ for (int j = 0 ; j < a[i].length; j++) {
+ b[i][j] = copyAnnotation(a[i][j], a[i][j]);
+ }
}
}
diff --git a/test/transform/resource/after-delombok/TypeUseAnnotations.java b/test/transform/resource/after-delombok/TypeUseAnnotations.java
index 1e1536bf..fbf32577 100644
--- a/test/transform/resource/after-delombok/TypeUseAnnotations.java
+++ b/test/transform/resource/after-delombok/TypeUseAnnotations.java
@@ -7,8 +7,18 @@ import java.util.List;
}
class TypeUseAnnotations {
List<@TA(x = 5) String> foo;
+ List<TypeUseAnnotations.@TA(x = 5) Inner> bar;
+
+ class Inner {
+ }
+
@java.lang.SuppressWarnings("all")
public List<@TA(x = 5) String> getFoo() {
return this.foo;
}
+
+ @java.lang.SuppressWarnings("all")
+ public List<TypeUseAnnotations.@TA(x = 5) Inner> getBar() {
+ return this.bar;
+ }
}
diff --git a/test/transform/resource/after-ecj/TypeUseAnnotations.java b/test/transform/resource/after-ecj/TypeUseAnnotations.java
index 156643b9..7041b59e 100644
--- a/test/transform/resource/after-ecj/TypeUseAnnotations.java
+++ b/test/transform/resource/after-ecj/TypeUseAnnotations.java
@@ -5,11 +5,20 @@ import java.util.List;
int x();
}
class TypeUseAnnotations {
+ class Inner {
+ Inner() {
+ super();
+ }
+ }
@lombok.Getter List<@TA(x = 5) String> foo;
+ @lombok.Getter List<TypeUseAnnotations.@TA(x = 5) Inner> bar;
TypeUseAnnotations() {
super();
}
public @java.lang.SuppressWarnings("all") List<@TA(x = 5) String> getFoo() {
return this.foo;
}
+ public @java.lang.SuppressWarnings("all") List<TypeUseAnnotations.@TA(x = 5) Inner> getBar() {
+ return this.bar;
+ }
} \ No newline at end of file
diff --git a/test/transform/resource/before/TypeUseAnnotations.java b/test/transform/resource/before/TypeUseAnnotations.java
index c09a291d..7175930f 100644
--- a/test/transform/resource/before/TypeUseAnnotations.java
+++ b/test/transform/resource/before/TypeUseAnnotations.java
@@ -8,4 +8,6 @@ import java.util.List;
}
class TypeUseAnnotations {
@lombok.Getter List<@TA(x=5) String> foo;
+ @lombok.Getter List<TypeUseAnnotations.@TA(x=5) Inner> bar;
+ class Inner { }
}