diff options
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r-- | test/transform/resource/before/NonNullWithGuava.java | 33 | ||||
-rw-r--r-- | test/transform/resource/before/NonNullWithJdk.java | 34 |
2 files changed, 67 insertions, 0 deletions
diff --git a/test/transform/resource/before/NonNullWithGuava.java b/test/transform/resource/before/NonNullWithGuava.java new file mode 100644 index 00000000..dc877daa --- /dev/null +++ b/test/transform/resource/before/NonNullWithGuava.java @@ -0,0 +1,33 @@ +//CONF: lombok.nonNull.exceptionType = Guava +import static com.google.common.base.Preconditions.*; +public class NonNullWithGuava { + @lombok.NonNull @lombok.Setter private String test; + + public void testMethod(@lombok.NonNull String arg) { + 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) { + checkNotNull(""); + } + + public void testMethodWithFakeCheck2(@lombok.NonNull String arg) { + com.google.common.base.Preconditions.checkNotNull(test); + } + + public void testMethodWithFakeCheckAssign(@lombok.NonNull String arg) { + test = checkNotNull(test); + } +} diff --git a/test/transform/resource/before/NonNullWithJdk.java b/test/transform/resource/before/NonNullWithJdk.java new file mode 100644 index 00000000..c8cbf2ee --- /dev/null +++ b/test/transform/resource/before/NonNullWithJdk.java @@ -0,0 +1,34 @@ +//version 7: +//CONF: lombok.nonNull.exceptionType = Jdk +import static java.util.Objects.*; +public class NonNullWithJdk { + @lombok.NonNull @lombok.Setter private String test; + + public void testMethod(@lombok.NonNull String arg) { + 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) { + requireNonNull(""); + } + + public void testMethodWithFakeCheck2(@lombok.NonNull String arg) { + java.util.Objects.requireNonNull(test); + } + + public void testMethodWithFakeCheckAssign(@lombok.NonNull String arg) { + test = requireNonNull(test); + } +} |