From 4e7414038ad9df25fb6d2ee76dd22421e1ff7005 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 25 Mar 2019 23:36:16 +0100 Subject: [i2078] Add possibility to generate assert on `@NonNull` --- .../resource/after-ecj/NonNullWithAssertion.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/transform/resource/after-ecj/NonNullWithAssertion.java (limited to 'test/transform/resource/after-ecj/NonNullWithAssertion.java') diff --git a/test/transform/resource/after-ecj/NonNullWithAssertion.java b/test/transform/resource/after-ecj/NonNullWithAssertion.java new file mode 100644 index 00000000..d6f2b0f1 --- /dev/null +++ b/test/transform/resource/after-ecj/NonNullWithAssertion.java @@ -0,0 +1,18 @@ +public class NonNullWithAssertion { + private @lombok.NonNull @lombok.Setter String test; + public NonNullWithAssertion() { + super(); + } + public void testMethod(@lombok.NonNull String arg) { + assert (arg != null): "arg is marked non-null but is null"; + System.out.println(arg); + } + public void testMethodWithIf(@lombok.NonNull String arg) { + if ((arg == null)) + throw new NullPointerException("Oops"); + } + public @java.lang.SuppressWarnings("all") void setTest(final @lombok.NonNull String test) { + assert (test != null): "test is marked non-null but is null"; + this.test = test; + } +} \ No newline at end of file -- cgit