diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2019-01-22 04:28:18 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2019-01-22 04:30:02 +0100 |
commit | ccd802503d8aa578be3f1f956d97b06a803de0aa (patch) | |
tree | 53bee7018a6dd79664ee9b711b7ca36146acb8c1 /test/transform | |
parent | ba4e69bf30bf1c761b84e78dbec1fa1e285b02b6 (diff) | |
download | lombok-ccd802503d8aa578be3f1f956d97b06a803de0aa.tar.gz lombok-ccd802503d8aa578be3f1f956d97b06a803de0aa.tar.bz2 lombok-ccd802503d8aa578be3f1f956d97b06a803de0aa.zip |
[fixes #2019] Lombok now properly deals with `@NonNull` specifically on the ‘type use’ of a parameter (and, in case of arrays, on the outermost dimension which is actually the first one listed. Weird corner case of the JLS).
Diffstat (limited to 'test/transform')
-rw-r--r-- | test/transform/resource/after-delombok/NonNullTypeUse.java | 32 | ||||
-rw-r--r-- | test/transform/resource/after-ecj/NonNullTypeUse.java | 40 | ||||
-rw-r--r-- | test/transform/resource/before/NonNullTypeUse.java | 19 |
3 files changed, 91 insertions, 0 deletions
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) { + } +} |