aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/pretty/resource/after/TypeAnnotations.java12
-rw-r--r--test/pretty/resource/before/TypeAnnotations.java13
-rw-r--r--test/transform/resource/after-delombok/NonNullTypeUse.java32
-rw-r--r--test/transform/resource/after-ecj/NonNullTypeUse.java40
-rw-r--r--test/transform/resource/before/NonNullTypeUse.java19
5 files changed, 116 insertions, 0 deletions
diff --git a/test/pretty/resource/after/TypeAnnotations.java b/test/pretty/resource/after/TypeAnnotations.java
index 760b5ef8..aa93f173 100644
--- a/test/pretty/resource/after/TypeAnnotations.java
+++ b/test/pretty/resource/after/TypeAnnotations.java
@@ -9,6 +9,12 @@ public class TypeAnnotations {
@Target(ElementType.TYPE_USE)
@interface Bar {
}
+ @Target(ElementType.TYPE_USE)
+ @interface Baz {
+ }
+ @Target(ElementType.TYPE_USE)
+ @interface Bat {
+ }
public List<@Foo String> test(@Foo String param) {
@Bar
String local = "bar";
@@ -19,4 +25,10 @@ public class TypeAnnotations {
public <@Foo T extends java.lang.@Foo Number> T test2(@Bar String... varargs) {
return null;
}
+ public void test3(String[][] arg, String[]... arg2) {
+ @Baz
+ String @Bar [] @Foo [] x;
+ }
+ public void test4(@Foo String @Bar [] @Baz [] @Bat ... y) {
+ }
}
diff --git a/test/pretty/resource/before/TypeAnnotations.java b/test/pretty/resource/before/TypeAnnotations.java
index a39337da..25982a7a 100644
--- a/test/pretty/resource/before/TypeAnnotations.java
+++ b/test/pretty/resource/before/TypeAnnotations.java
@@ -11,6 +11,12 @@ public class TypeAnnotations {
@Target(ElementType.TYPE_USE)
@interface Bar {}
+ @Target(ElementType.TYPE_USE)
+ @interface Baz {}
+
+ @Target(ElementType.TYPE_USE)
+ @interface Bat {}
+
public List<@Foo String> test(@Foo String param) {
@Bar String local = "bar";
@Foo java.io.@Foo File[] array = {};
@@ -20,4 +26,11 @@ public class TypeAnnotations {
public <@Foo T extends java.lang.@Foo Number> T test2(@Bar String... varargs) {
return null;
}
+
+ public void test3(String[][] arg, String[]... arg2) {
+ @Baz String @Bar [] @Foo [] x;
+ }
+
+ public void test4(@Foo String @Bar [] @Baz [] @Bat ... y) {
+ }
}
diff --git a/test/transform/resource/after-delombok/NonNullTypeUse.java b/test/transform/resource/after-delombok/NonNullTypeUse.java
new file mode 100644
index 00000000..27719480
--- /dev/null
+++ b/test/transform/resource/after-delombok/NonNullTypeUse.java
@@ -0,0 +1,32 @@
+import lombok.NonNull;
+class NonNullTypeUse {
+ void test1(@NonNull String[][][] args) {
+ if (args == null) {
+ throw new java.lang.NullPointerException("args is marked @NonNull but is null");
+ }
+ }
+ void test2(String @NonNull [][][] args) {
+ if (args == null) {
+ throw new java.lang.NullPointerException("args is marked @NonNull but is null");
+ }
+ }
+ void test3(String[] @NonNull [][] args) {
+ }
+ void test4(String[][] @NonNull [] args) {
+ }
+ void test5(@NonNull String simple) {
+ if (simple == null) {
+ throw new java.lang.NullPointerException("simple is marked @NonNull but is null");
+ }
+ }
+ void test6(java.lang.@NonNull String weird) {
+ if (weird == null) {
+ throw new java.lang.NullPointerException("weird is marked @NonNull but is null");
+ }
+ }
+ void test7(java.lang.String @NonNull [][] weird) {
+ if (weird == null) {
+ throw new java.lang.NullPointerException("weird is marked @NonNull but is null");
+ }
+ }
+}
diff --git a/test/transform/resource/after-ecj/NonNullTypeUse.java b/test/transform/resource/after-ecj/NonNullTypeUse.java
new file mode 100644
index 00000000..4cf1aa5a
--- /dev/null
+++ b/test/transform/resource/after-ecj/NonNullTypeUse.java
@@ -0,0 +1,40 @@
+import lombok.NonNull;
+class NonNullTypeUse {
+ NonNullTypeUse() {
+ super();
+ }
+ void test1(@NonNull String[][][] args) {
+ if ((args == null))
+ {
+ throw new java.lang.NullPointerException("args is marked @NonNull but is null");
+ }
+ }
+ void test2(String @NonNull [][][] args) {
+ if ((args == null))
+ {
+ throw new java.lang.NullPointerException("args is marked @NonNull but is null");
+ }
+ }
+ void test3(String[] @NonNull [][] args) {
+ }
+ void test4(String[][] @NonNull [] args) {
+ }
+ void test5(@NonNull String simple) {
+ if ((simple == null))
+ {
+ throw new java.lang.NullPointerException("simple is marked @NonNull but is null");
+ }
+ }
+ void test6(java.lang.@NonNull String weird) {
+ if ((weird == null))
+ {
+ throw new java.lang.NullPointerException("weird is marked @NonNull but is null");
+ }
+ }
+ void test7(java.lang.String @NonNull [][] weird) {
+ if ((weird == null))
+ {
+ throw new java.lang.NullPointerException("weird is marked @NonNull but is null");
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullTypeUse.java b/test/transform/resource/before/NonNullTypeUse.java
new file mode 100644
index 00000000..32179351
--- /dev/null
+++ b/test/transform/resource/before/NonNullTypeUse.java
@@ -0,0 +1,19 @@
+//version 8:
+import lombok.NonNull;
+
+class NonNullTypeUse {
+ void test1(@NonNull String[][][] args) {
+ }
+ void test2(String @NonNull [][][] args) {
+ }
+ void test3(String [] @NonNull [][] args) {
+ }
+ void test4(String [][] @NonNull [] args) {
+ }
+ void test5(@NonNull String simple) {
+ }
+ void test6(java.lang.@NonNull String weird) {
+ }
+ void test7(java.lang.String @NonNull [][] weird) {
+ }
+}