diff options
author | Caleb Brinkman <cbrinkman@sonatype.com> | 2019-07-16 10:39:54 -0500 |
---|---|---|
committer | Caleb Brinkman <cbrinkman@sonatype.com> | 2019-07-16 10:39:54 -0500 |
commit | 4dc5c32d6b47264b5c8abb6fdf24077eec5aa7e7 (patch) | |
tree | 9779fbf1d16dab92b0f5076f773870653de49820 /test/transform/resource/after-delombok | |
parent | 88bf742e3e107cc0bbfc3a72c2f456d34ef3079c (diff) | |
parent | 218f28cc95ee30d5d362c3ac9d5440c2f86fd712 (diff) | |
download | lombok-4dc5c32d6b47264b5c8abb6fdf24077eec5aa7e7.tar.gz lombok-4dc5c32d6b47264b5c8abb6fdf24077eec5aa7e7.tar.bz2 lombok-4dc5c32d6b47264b5c8abb6fdf24077eec5aa7e7.zip |
Merge branch 'master' of github.com:rzwitserloot/lombok into feature/builder-setter-prefixes
Diffstat (limited to 'test/transform/resource/after-delombok')
9 files changed, 131 insertions, 55 deletions
diff --git a/test/transform/resource/after-delombok/BuilderDefaults.java b/test/transform/resource/after-delombok/BuilderDefaults.java index b916b725..475b3f3c 100644 --- a/test/transform/resource/after-delombok/BuilderDefaults.java +++ b/test/transform/resource/after-delombok/BuilderDefaults.java @@ -21,19 +21,19 @@ public final class BuilderDefaults { @java.lang.SuppressWarnings("all") private boolean x$set; @java.lang.SuppressWarnings("all") - private int x; + private int x$value; @java.lang.SuppressWarnings("all") private String name; @java.lang.SuppressWarnings("all") private boolean z$set; @java.lang.SuppressWarnings("all") - private long z; + private long z$value; @java.lang.SuppressWarnings("all") BuilderDefaultsBuilder() { } @java.lang.SuppressWarnings("all") public BuilderDefaultsBuilder x(final int x) { - this.x = x; + this.x$value = x; x$set = true; return this; } @@ -44,22 +44,22 @@ public final class BuilderDefaults { } @java.lang.SuppressWarnings("all") public BuilderDefaultsBuilder z(final long z) { - this.z = z; + this.z$value = z; z$set = true; return this; } @java.lang.SuppressWarnings("all") public BuilderDefaults build() { - int x = this.x; - if (!x$set) x = BuilderDefaults.$default$x(); - long z = this.z; - if (!z$set) z = BuilderDefaults.$default$z(); - return new BuilderDefaults(x, name, z); + int x$value = this.x$value; + if (!x$set) x$value = BuilderDefaults.$default$x(); + long z$value = this.z$value; + if (!z$set) z$value = BuilderDefaults.$default$z(); + return new BuilderDefaults(x$value, name, z$value); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderDefaults.BuilderDefaultsBuilder(x=" + this.x + ", name=" + this.name + ", z=" + this.z + ")"; + return "BuilderDefaults.BuilderDefaultsBuilder(x$value=" + this.x$value + ", name=" + this.name + ", z$value=" + this.z$value + ")"; } } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java b/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java index b88a61be..46fcd6b4 100644 --- a/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java +++ b/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java @@ -26,50 +26,50 @@ public class BuilderDefaultsGenerics<N extends Number, T, R extends List<T>> { @java.lang.SuppressWarnings("all") private boolean callable$set; @java.lang.SuppressWarnings("all") - private java.util.concurrent.Callable<N> callable; + private java.util.concurrent.Callable<N> callable$value; @java.lang.SuppressWarnings("all") private boolean tee$set; @java.lang.SuppressWarnings("all") - private T tee; + private T tee$value; @java.lang.SuppressWarnings("all") private boolean arrr$set; @java.lang.SuppressWarnings("all") - private R arrr; + private R arrr$value; @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder() { } @java.lang.SuppressWarnings("all") public BuilderDefaultsGenericsBuilder<N, T, R> callable(final java.util.concurrent.Callable<N> callable) { - this.callable = callable; + this.callable$value = callable; callable$set = true; return this; } @java.lang.SuppressWarnings("all") public BuilderDefaultsGenericsBuilder<N, T, R> tee(final T tee) { - this.tee = tee; + this.tee$value = tee; tee$set = true; return this; } @java.lang.SuppressWarnings("all") public BuilderDefaultsGenericsBuilder<N, T, R> arrr(final R arrr) { - this.arrr = arrr; + this.arrr$value = arrr; arrr$set = true; return this; } @java.lang.SuppressWarnings("all") public BuilderDefaultsGenerics<N, T, R> build() { - java.util.concurrent.Callable<N> callable = this.callable; - if (!callable$set) callable = BuilderDefaultsGenerics.<N, T, R>$default$callable(); - T tee = this.tee; - if (!tee$set) tee = BuilderDefaultsGenerics.<N, T, R>$default$tee(); - R arrr = this.arrr; - if (!arrr$set) arrr = BuilderDefaultsGenerics.<N, T, R>$default$arrr(); - return new BuilderDefaultsGenerics<N, T, R>(callable, tee, arrr); + java.util.concurrent.Callable<N> callable$value = this.callable$value; + if (!callable$set) callable$value = BuilderDefaultsGenerics.<N, T, R>$default$callable(); + T tee$value = this.tee$value; + if (!tee$set) tee$value = BuilderDefaultsGenerics.<N, T, R>$default$tee(); + R arrr$value = this.arrr$value; + if (!arrr$set) arrr$value = BuilderDefaultsGenerics.<N, T, R>$default$arrr(); + return new BuilderDefaultsGenerics<N, T, R>(callable$value, tee$value, arrr$value); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder(callable=" + this.callable + ", tee=" + this.tee + ", arrr=" + this.arrr + ")"; + return "BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder(callable$value=" + this.callable$value + ", tee$value=" + this.tee$value + ", arrr$value=" + this.arrr$value + ")"; } } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java index 91f5b8be..f37c68af 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java @@ -10,7 +10,7 @@ final class ConstructorsWithBuilderDefaults { @java.lang.SuppressWarnings("all") private boolean x$set; @java.lang.SuppressWarnings("all") - private int x; + private int x$value; @java.lang.SuppressWarnings("all") private int y; @java.lang.SuppressWarnings("all") @@ -18,7 +18,7 @@ final class ConstructorsWithBuilderDefaults { } @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaultsBuilder x(final int x) { - this.x = x; + this.x$value = x; x$set = true; return this; } @@ -29,14 +29,14 @@ final class ConstructorsWithBuilderDefaults { } @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults build() { - int x = this.x; - if (!x$set) x = ConstructorsWithBuilderDefaults.$default$x(); - return new ConstructorsWithBuilderDefaults(x, y); + int x$value = this.x$value; + if (!x$set) x$value = ConstructorsWithBuilderDefaults.$default$x(); + return new ConstructorsWithBuilderDefaults(x$value, y); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x + ", y=" + this.y + ")"; + return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x$value=" + this.x$value + ", y=" + this.y + ")"; } } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java index 8a9c9b48..7816b0c8 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java @@ -23,11 +23,11 @@ final class ConstructorsWithBuilderDefaults<T> { @java.lang.SuppressWarnings("all") private boolean z$set; @java.lang.SuppressWarnings("all") - private java.util.List<T> z; + private java.util.List<T> z$value; @java.lang.SuppressWarnings("all") private boolean x$set; @java.lang.SuppressWarnings("all") - private T x; + private T x$value; @java.lang.SuppressWarnings("all") private T q; @java.lang.SuppressWarnings("all") @@ -35,13 +35,13 @@ final class ConstructorsWithBuilderDefaults<T> { } @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaultsBuilder<T> z(final java.util.List<T> z) { - this.z = z; + this.z$value = z; z$set = true; return this; } @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaultsBuilder<T> x(final T x) { - this.x = x; + this.x$value = x; x$set = true; return this; } @@ -53,16 +53,16 @@ final class ConstructorsWithBuilderDefaults<T> { @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults<T> build() { - java.util.List<T> z = this.z; - if (!z$set) z = ConstructorsWithBuilderDefaults.<T>$default$z(); - T x = this.x; - if (!x$set) x = ConstructorsWithBuilderDefaults.<T>$default$x(); - return new ConstructorsWithBuilderDefaults<T>(z, x, q); + java.util.List<T> z$value = this.z$value; + if (!z$set) z$value = ConstructorsWithBuilderDefaults.<T>$default$z(); + T x$value = this.x$value; + if (!x$set) x$value = ConstructorsWithBuilderDefaults.<T>$default$x(); + return new ConstructorsWithBuilderDefaults<T>(z$value, x$value, q); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(z=" + this.z + ", x=" + this.x + ", q=" + this.q + ")"; + return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(z$value=" + this.z$value + ", x$value=" + this.x$value + ", q=" + this.q + ")"; } } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/JacksonJsonProperty.java b/test/transform/resource/after-delombok/JacksonJsonProperty.java index 842ba298..16a8039e 100644 --- a/test/transform/resource/after-delombok/JacksonJsonProperty.java +++ b/test/transform/resource/after-delombok/JacksonJsonProperty.java @@ -1,6 +1,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; public class JacksonJsonProperty { @JsonProperty("kebab-case-prop") + @JsonSetter(nulls = Nulls.SKIP) public String kebabCaseProp; @java.lang.SuppressWarnings("all") JacksonJsonProperty(final String kebabCaseProp) { @@ -14,6 +17,7 @@ public class JacksonJsonProperty { JacksonJsonPropertyBuilder() { } @JsonProperty("kebab-case-prop") + @JsonSetter(nulls = Nulls.SKIP) @java.lang.SuppressWarnings("all") public JacksonJsonPropertyBuilder kebabCaseProp(final String kebabCaseProp) { this.kebabCaseProp = kebabCaseProp; @@ -34,6 +38,7 @@ public class JacksonJsonProperty { return new JacksonJsonPropertyBuilder(); } @JsonProperty("kebab-case-prop") + @JsonSetter(nulls = Nulls.SKIP) @java.lang.SuppressWarnings("all") public void setKebabCaseProp(final String kebabCaseProp) { this.kebabCaseProp = kebabCaseProp; diff --git a/test/transform/resource/after-delombok/NonNullWithGuava.java b/test/transform/resource/after-delombok/NonNullWithGuava.java new file mode 100644 index 00000000..b3c13d30 --- /dev/null +++ b/test/transform/resource/after-delombok/NonNullWithGuava.java @@ -0,0 +1,35 @@ +import static com.google.common.base.Preconditions.*; +public class NonNullWithGuava { + @lombok.NonNull + private String test; + 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); + } + @java.lang.SuppressWarnings("all") + public void setTest(@lombok.NonNull final String test) { + com.google.common.base.Preconditions.checkNotNull(test, "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/NonNullWithJdk.java b/test/transform/resource/after-delombok/NonNullWithJdk.java new file mode 100644 index 00000000..d7e2958c --- /dev/null +++ b/test/transform/resource/after-delombok/NonNullWithJdk.java @@ -0,0 +1,36 @@ +//version 7: +import static java.util.Objects.*; +public class NonNullWithJdk { + @lombok.NonNull + private String test; + 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); + } + @java.lang.SuppressWarnings("all") + public void setTest(@lombok.NonNull final String test) { + java.util.Objects.requireNonNull(test, "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/SuperBuilderWithDefaults.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java index 842b7e55..2ac3d1b7 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java @@ -16,31 +16,31 @@ public class SuperBuilderWithDefaults { @java.lang.SuppressWarnings("all")
private boolean millis$set;
@java.lang.SuppressWarnings("all")
- private long millis;
+ private long millis$value;
@java.lang.SuppressWarnings("all")
private boolean numberField$set;
@java.lang.SuppressWarnings("all")
- private N numberField;
+ private N numberField$value;
@java.lang.SuppressWarnings("all")
protected abstract B self();
@java.lang.SuppressWarnings("all")
public abstract C build();
@java.lang.SuppressWarnings("all")
public B millis(final long millis) {
- this.millis = millis;
+ this.millis$value = millis;
millis$set = true;
return self();
}
@java.lang.SuppressWarnings("all")
public B numberField(final N numberField) {
- this.numberField = numberField;
+ this.numberField$value = numberField;
numberField$set = true;
return self();
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
- return "SuperBuilderWithDefaults.Parent.ParentBuilder(millis=" + this.millis + ", numberField=" + this.numberField + ")";
+ return "SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value + ", numberField$value=" + this.numberField$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@@ -61,9 +61,9 @@ public class SuperBuilderWithDefaults { }
@java.lang.SuppressWarnings("all")
protected Parent(final ParentBuilder<N, ?, ?> b) {
- if (b.millis$set) this.millis = b.millis;
+ if (b.millis$set) this.millis = b.millis$value;
else this.millis = Parent.<N>$default$millis();
- if (b.numberField$set) this.numberField = b.numberField;
+ if (b.numberField$set) this.numberField = b.numberField$value;
else this.numberField = Parent.<N>$default$numberField();
}
@java.lang.SuppressWarnings("all")
@@ -82,7 +82,7 @@ public class SuperBuilderWithDefaults { @java.lang.SuppressWarnings("all")
private boolean doubleField$set;
@java.lang.SuppressWarnings("all")
- private double doubleField;
+ private double doubleField$value;
@java.lang.Override
@java.lang.SuppressWarnings("all")
protected abstract B self();
@@ -91,14 +91,14 @@ public class SuperBuilderWithDefaults { public abstract C build();
@java.lang.SuppressWarnings("all")
public B doubleField(final double doubleField) {
- this.doubleField = doubleField;
+ this.doubleField$value = doubleField;
doubleField$set = true;
return self();
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
- return "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField=" + this.doubleField + ")";
+ return "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@@ -120,7 +120,7 @@ public class SuperBuilderWithDefaults { @java.lang.SuppressWarnings("all")
protected Child(final ChildBuilder<?, ?> b) {
super(b);
- if (b.doubleField$set) this.doubleField = b.doubleField;
+ if (b.doubleField$set) this.doubleField = b.doubleField$value;
else this.doubleField = Child.$default$doubleField();
}
@java.lang.SuppressWarnings("all")
diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java index ce5c838c..52328780 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java @@ -12,7 +12,7 @@ public class SuperBuilderWithNonNull { @java.lang.SuppressWarnings("all")
private boolean nonNullParentField$set;
@java.lang.SuppressWarnings("all")
- private String nonNullParentField;
+ private String nonNullParentField$value;
@java.lang.SuppressWarnings("all")
protected abstract B self();
@java.lang.SuppressWarnings("all")
@@ -22,14 +22,14 @@ public class SuperBuilderWithNonNull { if (nonNullParentField == null) {
throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
}
- this.nonNullParentField = nonNullParentField;
+ this.nonNullParentField$value = nonNullParentField;
nonNullParentField$set = true;
return self();
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
- return "SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField=" + this.nonNullParentField + ")";
+ return "SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@@ -50,7 +50,7 @@ public class SuperBuilderWithNonNull { }
@java.lang.SuppressWarnings("all")
protected Parent(final ParentBuilder<?, ?> b) {
- if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField;
+ if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField$value;
else this.nonNullParentField = Parent.$default$nonNullParentField();
if (nonNullParentField == null) {
throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
|