diff options
Diffstat (limited to 'test/transform')
36 files changed, 210 insertions, 75 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/BuilderWithNoBuilderMethod.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java new file mode 100644 index 00000000..35e2c79e --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java @@ -0,0 +1,33 @@ +class BuilderWithNoBuilderMethod { + private String a = ""; + @java.lang.SuppressWarnings("all") + BuilderWithNoBuilderMethod(final String a) { + this.a = a; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithNoBuilderMethodBuilder { + @java.lang.SuppressWarnings("all") + private String a; + @java.lang.SuppressWarnings("all") + BuilderWithNoBuilderMethodBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethodBuilder a(final String a) { + this.a = a; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethod build() { + return new BuilderWithNoBuilderMethod(a); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a + ")"; + } + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethodBuilder toBuilder() { + return new BuilderWithNoBuilderMethodBuilder().a(this.a); + } +} 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); } diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java index 26023e1a..511c153a 100644 --- a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypes.java @@ -17,7 +17,7 @@ import lombok.Singular; public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder foo(final @MyAnnotation @NonNull 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>(); @@ -38,11 +38,11 @@ import lombok.Singular; public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder bar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull 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)) { diff --git a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java new file mode 100644 index 00000000..624b14b9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java @@ -0,0 +1,27 @@ +import lombok.Builder; +@Builder(toBuilder = true,builderMethodName = "") class BuilderWithNoBuilderMethod { + public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodBuilder { + private @java.lang.SuppressWarnings("all") String a; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder a(final String a) { + this.a = a; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod build() { + return new BuilderWithNoBuilderMethod(a); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a) + ")"); + } + } + private String a = ""; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod(final String a) { + super(); + this.a = a; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder toBuilder() { + return new BuilderWithNoBuilderMethodBuilder().a(this.a); + } +} diff --git a/test/transform/resource/after-ecj/ConstructorsWithAccessors.java b/test/transform/resource/after-ecj/ConstructorsWithAccessors.java index 6050ab9f..552c5c2d 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithAccessors.java +++ b/test/transform/resource/after-ecj/ConstructorsWithAccessors.java @@ -20,19 +20,19 @@ super(); 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-ecj/DataOnLocalClass.java b/test/transform/resource/after-ecj/DataOnLocalClass.java index ff2a3d20..ae986676 100644 --- a/test/transform/resource/after-ecj/DataOnLocalClass.java +++ b/test/transform/resource/after-ecj/DataOnLocalClass.java @@ -64,7 +64,7 @@ class DataOnLocalClass2 { public @java.lang.SuppressWarnings("all") void setName(final @lombok.NonNull 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; } @@ -99,7 +99,7 @@ class DataOnLocalClass2 { super(); 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-ecj/NonNullOnParameter.java b/test/transform/resource/after-ecj/NonNullOnParameter.java index fde47e1d..4f873ab6 100644 --- a/test/transform/resource/after-ecj/NonNullOnParameter.java +++ b/test/transform/resource/after-ecj/NonNullOnParameter.java @@ -1,16 +1,18 @@ class NonNullOnParameter extends Thread { + <clinit>() { + } 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(); @@ -18,11 +20,11 @@ class NonNullOnParameter extends Thread { 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)) { @@ -34,7 +36,7 @@ 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(); @@ -42,20 +44,26 @@ class NonNullOnParameter extends Thread { 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"; + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/NonNullOnParameterAbstract.java b/test/transform/resource/after-ecj/NonNullOnParameterAbstract.java index d3e1fdd6..cc8ddcaa 100644 --- a/test/transform/resource/after-ecj/NonNullOnParameterAbstract.java +++ b/test/transform/resource/after-ecj/NonNullOnParameterAbstract.java @@ -5,7 +5,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-ecj/NonNullOnParameterOfDefaultMethod.java b/test/transform/resource/after-ecj/NonNullOnParameterOfDefaultMethod.java index 7293bcf5..830cff13 100644 --- a/test/transform/resource/after-ecj/NonNullOnParameterOfDefaultMethod.java +++ b/test/transform/resource/after-ecj/NonNullOnParameterOfDefaultMethod.java @@ -3,7 +3,7 @@ interface NonNullOnParameterOfDefaultMethod { 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-ecj/NonNullPlain.java b/test/transform/resource/after-ecj/NonNullPlain.java index c703f38a..bf43cb7f 100644 --- a/test/transform/resource/after-ecj/NonNullPlain.java +++ b/test/transform/resource/after-ecj/NonNullPlain.java @@ -9,7 +9,7 @@ import java.lang.annotation.*; super(); 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; @@ -29,7 +29,7 @@ import java.lang.annotation.*; public @java.lang.SuppressWarnings("all") void setS(final @lombok.NonNull 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-ecj/NonNullTypeUse.java b/test/transform/resource/after-ecj/NonNullTypeUse.java index 4cf1aa5a..add140ea 100644 --- a/test/transform/resource/after-ecj/NonNullTypeUse.java +++ b/test/transform/resource/after-ecj/NonNullTypeUse.java @@ -6,13 +6,13 @@ 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) { @@ -22,19 +22,19 @@ 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"); } } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/NonNullWithAlternateException.java b/test/transform/resource/after-ecj/NonNullWithAlternateException.java index 39e9c0a8..9a2a4e3d 100644 --- a/test/transform/resource/after-ecj/NonNullWithAlternateException.java +++ b/test/transform/resource/after-ecj/NonNullWithAlternateException.java @@ -6,14 +6,14 @@ public class NonNullWithAlternateException { 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); } public @java.lang.SuppressWarnings("all") void setTest(final @lombok.NonNull 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-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 diff --git a/test/transform/resource/after-ecj/NonNullWithSneakyThrows.java b/test/transform/resource/after-ecj/NonNullWithSneakyThrows.java index 22799b5e..ee08dbf8 100644 --- a/test/transform/resource/after-ecj/NonNullWithSneakyThrows.java +++ b/test/transform/resource/after-ecj/NonNullWithSneakyThrows.java @@ -7,7 +7,7 @@ class NonNullWithSneakyThrows { { 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); } diff --git a/test/transform/resource/after-ecj/SetterOnClass.java b/test/transform/resource/after-ecj/SetterOnClass.java index c7aec900..9ed77bd4 100644 --- a/test/transform/resource/after-ecj/SetterOnClass.java +++ b/test/transform/resource/after-ecj/SetterOnClass.java @@ -64,7 +64,7 @@ public @java.lang.SuppressWarnings("all") void setNonNull(final @lombok.NonNull 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-ecj/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java index bb02024d..9b89f2a8 100644 --- a/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java @@ -19,7 +19,7 @@ import lombok.Singular; public @java.lang.SuppressWarnings("all") B foo(final @MyAnnotation @NonNull 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>(); @@ -40,11 +40,11 @@ import lombok.Singular; public @java.lang.SuppressWarnings("all") B bar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull 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)) { diff --git a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java index 1c4bd53d..4b5cb188 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java @@ -41,7 +41,7 @@ public class SuperBuilderWithNonNull { 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");
}
}
public static @java.lang.SuppressWarnings("all") ParentBuilder<?, ?> builder() {
@@ -81,7 +81,7 @@ public class SuperBuilderWithNonNull { 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");
}
}
public static @java.lang.SuppressWarnings("all") ChildBuilder<?, ?> builder() {
diff --git a/test/transform/resource/after-ecj/WitherOnClass.java b/test/transform/resource/after-ecj/WitherOnClass.java index 086ba591..166d1842 100644 --- a/test/transform/resource/after-ecj/WitherOnClass.java +++ b/test/transform/resource/after-ecj/WitherOnClass.java @@ -34,7 +34,7 @@ public @java.lang.SuppressWarnings("all") WitherOnClass3 withNonNull(final @lombok.NonNull 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)); } diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethod.java b/test/transform/resource/before/BuilderWithNoBuilderMethod.java new file mode 100644 index 00000000..3f2b21ac --- /dev/null +++ b/test/transform/resource/before/BuilderWithNoBuilderMethod.java @@ -0,0 +1,5 @@ +import lombok.Builder; +@Builder(toBuilder = true, builderMethodName = "") +class BuilderWithNoBuilderMethod { + private String a = ""; +} diff --git a/test/transform/resource/before/NonNullOnParameter.java b/test/transform/resource/before/NonNullOnParameter.java index 7eb4c565..22aceac7 100644 --- a/test/transform/resource/before/NonNullOnParameter.java +++ b/test/transform/resource/before/NonNullOnParameter.java @@ -27,4 +27,13 @@ class NonNullOnParameter extends Thread { 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"; + } + }
\ No newline at end of file diff --git a/test/transform/resource/before/NonNullWithAssertion.java b/test/transform/resource/before/NonNullWithAssertion.java new file mode 100644 index 00000000..c3d271a6 --- /dev/null +++ b/test/transform/resource/before/NonNullWithAssertion.java @@ -0,0 +1,13 @@ +//CONF: lombok.nonNull.exceptionType = Assertion + +public class NonNullWithAssertion { + @lombok.NonNull @lombok.Setter private String test; + + public void testMethod(@lombok.NonNull String arg) { + System.out.println(arg); + } + + public void testMethodWithIf(@lombok.NonNull String arg) { + if (arg == null) throw new NullPointerException("Oops"); + } +} diff --git a/test/transform/resource/messages-delombok/BuilderDefaultsWarnings.java.messages b/test/transform/resource/messages-delombok/BuilderDefaultsWarnings.java.messages index 694511f8..c6590132 100644 --- a/test/transform/resource/messages-delombok/BuilderDefaultsWarnings.java.messages +++ b/test/transform/resource/messages-delombok/BuilderDefaultsWarnings.java.messages @@ -1,4 +1,4 @@ 13 @Builder.Default requires @Builder on the class for it to mean anything. -6 @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final. 8 @Builder.Default requires an initializing expression (' = something;'). 9 @Builder.Default and @Singular cannot be mixed. +6 @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final. |