aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2019-03-25 23:36:16 +0100
committerRoel Spilker <r.spilker@gmail.com>2019-03-26 00:00:42 +0100
commit4e7414038ad9df25fb6d2ee76dd22421e1ff7005 (patch)
tree8ad77bb929cd0f7e5e47f410c6df4d3b4b2912b7 /test/transform/resource/after-delombok
parente4b61e1263eb0eb832eb6cfbd97ad92e869ca27e (diff)
downloadlombok-4e7414038ad9df25fb6d2ee76dd22421e1ff7005.tar.gz
lombok-4e7414038ad9df25fb6d2ee76dd22421e1ff7005.tar.bz2
lombok-4e7414038ad9df25fb6d2ee76dd22421e1ff7005.zip
[i2078] Add possibility to generate assert on `@NonNull`
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java6
-rw-r--r--test/transform/resource/after-delombok/ConstructorsWithAccessors.java8
-rw-r--r--test/transform/resource/after-delombok/DataOnLocalClass.java4
-rw-r--r--test/transform/resource/after-delombok/NonNullOnParameter.java22
-rw-r--r--test/transform/resource/after-delombok/NonNullOnParameterAbstract.java2
-rw-r--r--test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java2
-rw-r--r--test/transform/resource/after-delombok/NonNullPlain.java4
-rw-r--r--test/transform/resource/after-delombok/NonNullTypeUse.java10
-rw-r--r--test/transform/resource/after-delombok/NonNullWithAlternateException.java4
-rw-r--r--test/transform/resource/after-delombok/NonNullWithAssertion.java16
-rw-r--r--test/transform/resource/after-delombok/NonNullWithSneakyThrows.java2
-rw-r--r--test/transform/resource/after-delombok/SetterOnClass.java2
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java6
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderWithNonNull.java8
-rw-r--r--test/transform/resource/after-delombok/WitherOnClass.java2
15 files changed, 60 insertions, 38 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
index 93825659..88459e67 100644
--- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
+++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
@@ -28,7 +28,7 @@ class BuilderSingularAnnotatedTypes {
@java.lang.SuppressWarnings("all")
public BuilderSingularAnnotatedTypesBuilder foo(@MyAnnotation @NonNull final String foo) {
if (foo == null) {
- throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("foo is marked non-null but is null");
}
if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
this.foos.add(foo);
@@ -48,10 +48,10 @@ class BuilderSingularAnnotatedTypes {
@java.lang.SuppressWarnings("all")
public BuilderSingularAnnotatedTypesBuilder bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
if (barKey == null) {
- throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("barKey is marked non-null but is null");
}
if (barValue == null) {
- throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("barValue is marked non-null but is null");
}
if (this.bars$key == null) {
this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
diff --git a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java
index 2e09b2df..3614d682 100644
--- a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java
+++ b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java
@@ -26,16 +26,16 @@ class ConstructorsWithAccessorsNonNull {
@java.lang.SuppressWarnings("all")
public ConstructorsWithAccessorsNonNull(@lombok.NonNull final Integer plower, @lombok.NonNull final Integer upper, @lombok.NonNull final Integer huh, @lombok.NonNull final Integer _huh2) {
if (plower == null) {
- throw new java.lang.NullPointerException("plower is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("plower is marked non-null but is null");
}
if (upper == null) {
- throw new java.lang.NullPointerException("upper is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("upper is marked non-null but is null");
}
if (huh == null) {
- throw new java.lang.NullPointerException("huh is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("huh is marked non-null but is null");
}
if (_huh2 == null) {
- throw new java.lang.NullPointerException("_huh2 is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("_huh2 is marked non-null but is null");
}
this.plower = plower;
this.pUpper = upper;
diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java
index d611490b..80f3ca83 100644
--- a/test/transform/resource/after-delombok/DataOnLocalClass.java
+++ b/test/transform/resource/after-delombok/DataOnLocalClass.java
@@ -64,7 +64,7 @@ class DataOnLocalClass2 {
@java.lang.SuppressWarnings("all")
public InnerLocal(@lombok.NonNull final String name) {
if (name == null) {
- throw new java.lang.NullPointerException("name is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("name is marked non-null but is null");
}
this.name = name;
}
@@ -76,7 +76,7 @@ class DataOnLocalClass2 {
@java.lang.SuppressWarnings("all")
public void setName(@lombok.NonNull final String name) {
if (name == null) {
- throw new java.lang.NullPointerException("name is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("name is marked non-null but is null");
}
this.name = name;
}
diff --git a/test/transform/resource/after-delombok/NonNullOnParameter.java b/test/transform/resource/after-delombok/NonNullOnParameter.java
index fa06e41b..4f6df920 100644
--- a/test/transform/resource/after-delombok/NonNullOnParameter.java
+++ b/test/transform/resource/after-delombok/NonNullOnParameter.java
@@ -2,22 +2,22 @@ class NonNullOnParameter extends Thread {
NonNullOnParameter(@lombok.NonNull String arg) {
this(arg, "");
if (arg == null) {
- throw new java.lang.NullPointerException("arg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg is marked non-null but is null");
}
}
NonNullOnParameter(@lombok.NonNull String arg, @lombok.NonNull String arg2) {
super(arg);
if (arg2 == null) {
- throw new java.lang.NullPointerException("arg2 is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg2 is marked non-null but is null");
}
if (arg == null) throw new NullPointerException();
}
public void test2(@lombok.NonNull String arg, @lombok.NonNull String arg2, @lombok.NonNull String arg3) {
if (arg == null) {
- throw new java.lang.NullPointerException("arg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg is marked non-null but is null");
}
if (arg3 == null) {
- throw new java.lang.NullPointerException("arg3 is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg3 is marked non-null but is null");
}
if (arg2 == null) {
throw new NullPointerException("arg2");
@@ -26,23 +26,29 @@ class NonNullOnParameter extends Thread {
}
public void test3(@lombok.NonNull String arg) {
if (arg == null) {
- throw new java.lang.NullPointerException("arg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg is marked non-null but is null");
}
if (arg != null) throw new IllegalStateException();
}
public void test(@lombok.NonNull String stringArg, @lombok.NonNull String arg2, @lombok.NonNull int primitiveArg) {
if (stringArg == null) {
- throw new java.lang.NullPointerException("stringArg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("stringArg is marked non-null but is null");
}
if (arg2 == null) {
- throw new java.lang.NullPointerException("arg2 is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg2 is marked non-null but is null");
}
}
public void test(@lombok.NonNull String arg) {
if (arg == null) {
- throw new java.lang.NullPointerException("arg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg is marked non-null but is null");
}
System.out.println("Hey");
if (arg == null) throw new NullPointerException();
}
+ public void testWithAssert(@lombok.NonNull String param) {
+ assert param != null;
+ }
+ public void testWithAssertAndMessage(@lombok.NonNull String param) {
+ assert param != null : "Oops";
+ }
}
diff --git a/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java b/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java
index a2dcb49c..88577f25 100644
--- a/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java
+++ b/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java
@@ -1,7 +1,7 @@
abstract class NonNullOnParameterAbstract {
public void test(@lombok.NonNull String arg) {
if (arg == null) {
- throw new java.lang.NullPointerException("arg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg is marked non-null but is null");
}
System.out.println("Hey");
}
diff --git a/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java b/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java
index cf10253b..876a3440 100644
--- a/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java
+++ b/test/transform/resource/after-delombok/NonNullOnParameterOfDefaultMethod.java
@@ -3,7 +3,7 @@ interface NonNullOnParameterOfDefaultMethod {
void test(@lombok.NonNull String arg);
default void test2(@lombok.NonNull String arg) {
if (arg == null) {
- throw new java.lang.NullPointerException("arg is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("arg is marked non-null but is null");
}
System.out.println(arg);
}
diff --git a/test/transform/resource/after-delombok/NonNullPlain.java b/test/transform/resource/after-delombok/NonNullPlain.java
index d3de3dcf..24377237 100644
--- a/test/transform/resource/after-delombok/NonNullPlain.java
+++ b/test/transform/resource/after-delombok/NonNullPlain.java
@@ -13,7 +13,7 @@ class NonNullPlain {
@java.lang.SuppressWarnings("all")
public NonNullPlain(@lombok.NonNull final int i, @lombok.NonNull final String s) {
if (s == null) {
- throw new java.lang.NullPointerException("s is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("s is marked non-null but is null");
}
this.i = i;
this.s = s;
@@ -39,7 +39,7 @@ class NonNullPlain {
@java.lang.SuppressWarnings("all")
public void setS(@lombok.NonNull final String s) {
if (s == null) {
- throw new java.lang.NullPointerException("s is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("s is marked non-null but is null");
}
this.s = s;
}
diff --git a/test/transform/resource/after-delombok/NonNullTypeUse.java b/test/transform/resource/after-delombok/NonNullTypeUse.java
index 27719480..7c438501 100644
--- a/test/transform/resource/after-delombok/NonNullTypeUse.java
+++ b/test/transform/resource/after-delombok/NonNullTypeUse.java
@@ -2,12 +2,12 @@ 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");
+ throw new java.lang.NullPointerException("args is marked non-null but is null");
}
}
void test2(String @NonNull [][][] args) {
if (args == null) {
- throw new java.lang.NullPointerException("args is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("args is marked non-null but is null");
}
}
void test3(String[] @NonNull [][] args) {
@@ -16,17 +16,17 @@ class NonNullTypeUse {
}
void test5(@NonNull String simple) {
if (simple == null) {
- throw new java.lang.NullPointerException("simple is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("simple is marked non-null 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");
+ throw new java.lang.NullPointerException("weird is marked non-null 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");
+ throw new java.lang.NullPointerException("weird is marked non-null but is null");
}
}
}
diff --git a/test/transform/resource/after-delombok/NonNullWithAlternateException.java b/test/transform/resource/after-delombok/NonNullWithAlternateException.java
index 982da7d8..7f30fd1f 100644
--- a/test/transform/resource/after-delombok/NonNullWithAlternateException.java
+++ b/test/transform/resource/after-delombok/NonNullWithAlternateException.java
@@ -3,14 +3,14 @@ public class NonNullWithAlternateException {
private String test;
public void testMethod(@lombok.NonNull String arg) {
if (arg == null) {
- throw new java.lang.IllegalArgumentException("arg is marked @NonNull but is null");
+ throw new java.lang.IllegalArgumentException("arg is marked non-null but is null");
}
System.out.println(arg);
}
@java.lang.SuppressWarnings("all")
public void setTest(@lombok.NonNull final String test) {
if (test == null) {
- throw new java.lang.IllegalArgumentException("test is marked @NonNull but is null");
+ throw new java.lang.IllegalArgumentException("test is marked non-null but is null");
}
this.test = test;
}
diff --git a/test/transform/resource/after-delombok/NonNullWithAssertion.java b/test/transform/resource/after-delombok/NonNullWithAssertion.java
new file mode 100644
index 00000000..15dc0254
--- /dev/null
+++ b/test/transform/resource/after-delombok/NonNullWithAssertion.java
@@ -0,0 +1,16 @@
+public class NonNullWithAssertion {
+ @lombok.NonNull
+ private String test;
+ 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");
+ }
+ @java.lang.SuppressWarnings("all")
+ public void setTest(@lombok.NonNull final String test) {
+ assert test != null : "test is marked non-null but is null";
+ this.test = test;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java b/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java
index 5000f16d..44640164 100644
--- a/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java
+++ b/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java
@@ -2,7 +2,7 @@ class NonNullWithSneakyThrows {
void test(@lombok.NonNull String in) {
try {
if (in == null) {
- throw new java.lang.NullPointerException("in is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("in is marked non-null but is null");
}
System.out.println(in);
} catch (final java.lang.Throwable $ex) {
diff --git a/test/transform/resource/after-delombok/SetterOnClass.java b/test/transform/resource/after-delombok/SetterOnClass.java
index f880e20b..24f376cb 100644
--- a/test/transform/resource/after-delombok/SetterOnClass.java
+++ b/test/transform/resource/after-delombok/SetterOnClass.java
@@ -54,7 +54,7 @@ class SetterOnClass6 {
@java.lang.SuppressWarnings("all")
public void setNonNull(@lombok.NonNull final String nonNull) {
if (nonNull == null) {
- throw new java.lang.NullPointerException("nonNull is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("nonNull is marked non-null but is null");
}
this.nonNull = nonNull;
}
diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
index 1baf81aa..61c2557c 100644
--- a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
+++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
@@ -24,7 +24,7 @@ class SuperBuilderSingularAnnotatedTypes {
@java.lang.SuppressWarnings("all")
public B foo(@MyAnnotation @NonNull final String foo) {
if (foo == null) {
- throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("foo is marked non-null but is null");
}
if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
this.foos.add(foo);
@@ -44,10 +44,10 @@ class SuperBuilderSingularAnnotatedTypes {
@java.lang.SuppressWarnings("all")
public B bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
if (barKey == null) {
- throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("barKey is marked non-null but is null");
}
if (barValue == null) {
- throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("barValue is marked non-null but is null");
}
if (this.bars$key == null) {
this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
index cac5482b..ce5c838c 100644
--- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
+++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
@@ -20,7 +20,7 @@ public class SuperBuilderWithNonNull {
@java.lang.SuppressWarnings("all")
public B nonNullParentField(@lombok.NonNull final String nonNullParentField) {
if (nonNullParentField == null) {
- throw new java.lang.NullPointerException("nonNullParentField is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
}
this.nonNullParentField = nonNullParentField;
nonNullParentField$set = true;
@@ -53,7 +53,7 @@ public class SuperBuilderWithNonNull {
if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField;
else this.nonNullParentField = Parent.$default$nonNullParentField();
if (nonNullParentField == null) {
- throw new java.lang.NullPointerException("nonNullParentField is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
}
}
@java.lang.SuppressWarnings("all")
@@ -77,7 +77,7 @@ public class SuperBuilderWithNonNull {
@java.lang.SuppressWarnings("all")
public B nonNullChildField(@lombok.NonNull final String nonNullChildField) {
if (nonNullChildField == null) {
- throw new java.lang.NullPointerException("nonNullChildField is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
}
this.nonNullChildField = nonNullChildField;
return self();
@@ -109,7 +109,7 @@ public class SuperBuilderWithNonNull {
super(b);
this.nonNullChildField = b.nonNullChildField;
if (nonNullChildField == null) {
- throw new java.lang.NullPointerException("nonNullChildField is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
}
}
@java.lang.SuppressWarnings("all")
diff --git a/test/transform/resource/after-delombok/WitherOnClass.java b/test/transform/resource/after-delombok/WitherOnClass.java
index 93309c89..abc93446 100644
--- a/test/transform/resource/after-delombok/WitherOnClass.java
+++ b/test/transform/resource/after-delombok/WitherOnClass.java
@@ -36,7 +36,7 @@ class WitherOnClass3 {
@java.lang.SuppressWarnings("all")
public WitherOnClass3 withNonNull(@lombok.NonNull final String nonNull) {
if (nonNull == null) {
- throw new java.lang.NullPointerException("nonNull is marked @NonNull but is null");
+ throw new java.lang.NullPointerException("nonNull is marked non-null but is null");
}
return this.nonNull == nonNull ? this : new WitherOnClass3(this.couldBeNull, nonNull);
}