aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-ecj
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2019-07-16 02:04:11 +0200
committerRoel Spilker <r.spilker@gmail.com>2019-07-16 02:04:11 +0200
commitaa80e1baf92f3327383b36466a771e92d8a91b05 (patch)
tree312ec2e35698608fbfe877e208ca4c8428b1593c /test/transform/resource/after-ecj
parente1d1415d6e147edacaa50d8954737a168fbdafb5 (diff)
downloadlombok-aa80e1baf92f3327383b36466a771e92d8a91b05.tar.gz
lombok-aa80e1baf92f3327383b36466a771e92d8a91b05.tar.bz2
lombok-aa80e1baf92f3327383b36466a771e92d8a91b05.zip
Fixes #1197, add Objects.requireNonNull and Preconditions.checkkNotNull to supported null-check styles
Diffstat (limited to 'test/transform/resource/after-ecj')
-rw-r--r--test/transform/resource/after-ecj/NonNullWithGuava.java36
-rw-r--r--test/transform/resource/after-ecj/NonNullWithJdk.java37
2 files changed, 73 insertions, 0 deletions
diff --git a/test/transform/resource/after-ecj/NonNullWithGuava.java b/test/transform/resource/after-ecj/NonNullWithGuava.java
new file mode 100644
index 00000000..c7f5a7fe
--- /dev/null
+++ b/test/transform/resource/after-ecj/NonNullWithGuava.java
@@ -0,0 +1,36 @@
+import static com.google.common.base.Preconditions.*;
+public class NonNullWithGuava {
+ private @lombok.NonNull @lombok.Setter String test;
+ public NonNullWithGuava() {
+ super();
+ }
+ public void testMethod(@lombok.NonNull String arg) {
+ com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
+ System.out.println(arg);
+ }
+ public void testMethodWithCheck1(@lombok.NonNull String arg) {
+ checkNotNull(arg);
+ }
+ public void testMethodWithCheckAssign(@lombok.NonNull String arg) {
+ test = checkNotNull(arg);
+ }
+ public void testMethodWithCheck2(@lombok.NonNull String arg) {
+ com.google.common.base.Preconditions.checkNotNull(arg);
+ }
+ public void testMethodWithFakeCheck1(@lombok.NonNull String arg) {
+ com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
+ checkNotNull("");
+ }
+ public void testMethodWithFakeCheck2(@lombok.NonNull String arg) {
+ com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
+ com.google.common.base.Preconditions.checkNotNull(test);
+ }
+ public void testMethodWithFakeCheckAssign(@lombok.NonNull String arg) {
+ com.google.common.base.Preconditions.checkNotNull(arg, "arg is marked non-null but is null");
+ test = checkNotNull(test);
+ }
+ public @java.lang.SuppressWarnings("all") void setTest(final @lombok.NonNull String test) {
+ com.google.common.base.Preconditions.checkNotNull(test, "test is marked non-null but is null");
+ this.test = test;
+ }
+}
diff --git a/test/transform/resource/after-ecj/NonNullWithJdk.java b/test/transform/resource/after-ecj/NonNullWithJdk.java
new file mode 100644
index 00000000..7d522260
--- /dev/null
+++ b/test/transform/resource/after-ecj/NonNullWithJdk.java
@@ -0,0 +1,37 @@
+//version 7:
+import static java.util.Objects.*;
+public class NonNullWithJdk {
+ private @lombok.NonNull @lombok.Setter String test;
+ public NonNullWithJdk() {
+ super();
+ }
+ public void testMethod(@lombok.NonNull String arg) {
+ java.util.Objects.requireNonNull(arg, "arg is marked non-null but is null");
+ System.out.println(arg);
+ }
+ public void testMethodWithCheck1(@lombok.NonNull String arg) {
+ requireNonNull(arg);
+ }
+ public void testMethodWithCheckAssign(@lombok.NonNull String arg) {
+ test = requireNonNull(arg);
+ }
+ public void testMethodWithCheck2(@lombok.NonNull String arg) {
+ java.util.Objects.requireNonNull(arg);
+ }
+ public void testMethodWithFakeCheck1(@lombok.NonNull String arg) {
+ java.util.Objects.requireNonNull(arg, "arg is marked non-null but is null");
+ requireNonNull("");
+ }
+ public void testMethodWithFakeCheck2(@lombok.NonNull String arg) {
+ java.util.Objects.requireNonNull(arg, "arg is marked non-null but is null");
+ java.util.Objects.requireNonNull(test);
+ }
+ public void testMethodWithFakeCheckAssign(@lombok.NonNull String arg) {
+ java.util.Objects.requireNonNull(arg, "arg is marked non-null but is null");
+ test = requireNonNull(test);
+ }
+ public @java.lang.SuppressWarnings("all") void setTest(final @lombok.NonNull String test) {
+ java.util.Objects.requireNonNull(test, "test is marked non-null but is null");
+ this.test = test;
+ }
+}