diff options
Diffstat (limited to 'test')
6 files changed, 178 insertions, 52 deletions
diff --git a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java index bd934b44..91f5b8be 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java @@ -1,5 +1,6 @@ final class ConstructorsWithBuilderDefaults { private final int x; + private final int y; @java.lang.SuppressWarnings("all") private static int $default$x() { return 5; @@ -11,6 +12,8 @@ final class ConstructorsWithBuilderDefaults { @java.lang.SuppressWarnings("all") private int x; @java.lang.SuppressWarnings("all") + private int y; + @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { } @java.lang.SuppressWarnings("all") @@ -20,15 +23,20 @@ final class ConstructorsWithBuilderDefaults { return this; } @java.lang.SuppressWarnings("all") + public ConstructorsWithBuilderDefaultsBuilder y(final int y) { + this.y = y; + return this; + } + @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults build() { int x = this.x; if (!x$set) x = ConstructorsWithBuilderDefaults.$default$x(); - return new ConstructorsWithBuilderDefaults(x); + return new ConstructorsWithBuilderDefaults(x, y); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x + ")"; + return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x + ", y=" + this.y + ")"; } } @java.lang.SuppressWarnings("all") @@ -39,6 +47,10 @@ final class ConstructorsWithBuilderDefaults { public int getX() { return this.x; } + @java.lang.SuppressWarnings("all") + public int getY() { + return this.y; + } @java.lang.Override @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { @@ -46,6 +58,7 @@ final class ConstructorsWithBuilderDefaults { if (!(o instanceof ConstructorsWithBuilderDefaults)) return false; final ConstructorsWithBuilderDefaults other = (ConstructorsWithBuilderDefaults) o; if (this.getX() != other.getX()) return false; + if (this.getY() != other.getY()) return false; return true; } @java.lang.Override @@ -54,19 +67,22 @@ final class ConstructorsWithBuilderDefaults { final int PRIME = 59; int result = 1; result = result * PRIME + this.getX(); + result = result * PRIME + this.getY(); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorsWithBuilderDefaults(x=" + this.getX() + ")"; + return "ConstructorsWithBuilderDefaults(x=" + this.getX() + ", y=" + this.getY() + ")"; } @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults() { + this.y = 0; this.x = ConstructorsWithBuilderDefaults.$default$x(); } @java.lang.SuppressWarnings("all") - public ConstructorsWithBuilderDefaults(final int x) { + public ConstructorsWithBuilderDefaults(final int x, final int y) { this.x = x; + this.y = y; } } diff --git a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java index 2576e2a9..8a9c9b48 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java @@ -1,61 +1,107 @@ //CONF: lombok.noArgsConstructor.extraPrivate = true import lombok.NoArgsConstructor; -final class ConstructorsWithBuilderDefaults { - private final int x; +final class ConstructorsWithBuilderDefaults<T> { + private final java.util.List<T> z; + private final T x; + private final T q; @java.lang.SuppressWarnings("all") - private static int $default$x() { - return 5; + private static <T> java.util.List<T> $default$z() { + return new java.util.ArrayList<T>(); } @java.lang.SuppressWarnings("all") - ConstructorsWithBuilderDefaults(final int x) { + private static <T> T $default$x() { + return null; + } + @java.lang.SuppressWarnings("all") + ConstructorsWithBuilderDefaults(final java.util.List<T> z, final T x, final T q) { + this.z = z; this.x = x; + this.q = q; } @java.lang.SuppressWarnings("all") - public static class ConstructorsWithBuilderDefaultsBuilder { + public static class ConstructorsWithBuilderDefaultsBuilder<T> { + @java.lang.SuppressWarnings("all") + private boolean z$set; + @java.lang.SuppressWarnings("all") + private java.util.List<T> z; @java.lang.SuppressWarnings("all") private boolean x$set; @java.lang.SuppressWarnings("all") - private int x; + private T x; + @java.lang.SuppressWarnings("all") + private T q; @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { } @java.lang.SuppressWarnings("all") - public ConstructorsWithBuilderDefaultsBuilder x(final int x) { + public ConstructorsWithBuilderDefaultsBuilder<T> z(final java.util.List<T> z) { + this.z = z; + z$set = true; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorsWithBuilderDefaultsBuilder<T> x(final T x) { this.x = x; x$set = true; return this; } @java.lang.SuppressWarnings("all") - public ConstructorsWithBuilderDefaults build() { - int x = this.x; - if (!x$set) x = ConstructorsWithBuilderDefaults.$default$x(); - return new ConstructorsWithBuilderDefaults(x); + public ConstructorsWithBuilderDefaultsBuilder<T> q(final T q) { + this.q = q; + return this; + } + + @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.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x + ")"; + return "ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(z=" + this.z + ", x=" + this.x + ", q=" + this.q + ")"; } } @java.lang.SuppressWarnings("all") - public static ConstructorsWithBuilderDefaultsBuilder builder() { - return new ConstructorsWithBuilderDefaultsBuilder(); + public static <T> ConstructorsWithBuilderDefaultsBuilder<T> builder() { + return new ConstructorsWithBuilderDefaultsBuilder<T>(); } @java.lang.SuppressWarnings("all") private ConstructorsWithBuilderDefaults() { + this.q = null; + this.z = ConstructorsWithBuilderDefaults.$default$z(); this.x = ConstructorsWithBuilderDefaults.$default$x(); } @java.lang.SuppressWarnings("all") - public int getX() { + public java.util.List<T> getZ() { + return this.z; + } + @java.lang.SuppressWarnings("all") + public T getX() { return this.x; } + @java.lang.SuppressWarnings("all") + public T getQ() { + return this.q; + } @java.lang.Override @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof ConstructorsWithBuilderDefaults)) return false; - final ConstructorsWithBuilderDefaults other = (ConstructorsWithBuilderDefaults) o; - if (this.getX() != other.getX()) return false; + final ConstructorsWithBuilderDefaults<?> other = (ConstructorsWithBuilderDefaults<?>) o; + final java.lang.Object this$z = this.getZ(); + final java.lang.Object other$z = other.getZ(); + if (this$z == null ? other$z != null : !this$z.equals(other$z)) return false; + final java.lang.Object this$x = this.getX(); + final java.lang.Object other$x = other.getX(); + if (this$x == null ? other$x != null : !this$x.equals(other$x)) return false; + final java.lang.Object this$q = this.getQ(); + final java.lang.Object other$q = other.getQ(); + if (this$q == null ? other$q != null : !this$q.equals(other$q)) return false; return true; } @java.lang.Override @@ -63,12 +109,17 @@ final class ConstructorsWithBuilderDefaults { public int hashCode() { final int PRIME = 59; int result = 1; - result = result * PRIME + this.getX(); + final java.lang.Object $z = this.getZ(); + result = result * PRIME + ($z == null ? 43 : $z.hashCode()); + final java.lang.Object $x = this.getX(); + result = result * PRIME + ($x == null ? 43 : $x.hashCode()); + final java.lang.Object $q = this.getQ(); + result = result * PRIME + ($q == null ? 43 : $q.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "ConstructorsWithBuilderDefaults(x=" + this.getX() + ")"; + return "ConstructorsWithBuilderDefaults(z=" + this.getZ() + ", x=" + this.getX() + ", q=" + this.getQ() + ")"; } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java index 81d59a37..9d4c42c1 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java @@ -2,10 +2,11 @@ import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.Value; import lombok.Builder; -final @NoArgsConstructor @AllArgsConstructor @Builder @Value class ConstructorsWithBuilderDefaults { +final @NoArgsConstructor(force = true) @AllArgsConstructor @Builder @Value class ConstructorsWithBuilderDefaults { public static @java.lang.SuppressWarnings("all") class ConstructorsWithBuilderDefaultsBuilder { private @java.lang.SuppressWarnings("all") int x; private @java.lang.SuppressWarnings("all") boolean x$set; + private @java.lang.SuppressWarnings("all") int y; @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { super(); } @@ -14,14 +15,19 @@ final @NoArgsConstructor @AllArgsConstructor @Builder @Value class ConstructorsW x$set = true; return this; } + public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder y(final int y) { + this.y = y; + return this; + } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults build() { - return new ConstructorsWithBuilderDefaults((x$set ? x : ConstructorsWithBuilderDefaults.$default$x())); + return new ConstructorsWithBuilderDefaults((x$set ? x : ConstructorsWithBuilderDefaults.$default$x()), y); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x) + ")"); + return (((("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x) + ", y=") + this.y) + ")"); } } private final @Builder.Default int x; + private final int y; private static @java.lang.SuppressWarnings("all") int $default$x() { return 5; } @@ -31,6 +37,9 @@ final @NoArgsConstructor @AllArgsConstructor @Builder @Value class ConstructorsW public @java.lang.SuppressWarnings("all") int getX() { return this.x; } + public @java.lang.SuppressWarnings("all") int getY() { + return this.y; + } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; @@ -39,23 +48,28 @@ final @NoArgsConstructor @AllArgsConstructor @Builder @Value class ConstructorsW final ConstructorsWithBuilderDefaults other = (ConstructorsWithBuilderDefaults) o; if ((this.getX() != other.getX())) return false; + if ((this.getY() != other.getY())) + return false; return true; } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 59; int result = 1; result = ((result * PRIME) + this.getX()); + result = ((result * PRIME) + this.getY()); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ConstructorsWithBuilderDefaults(x=" + this.getX()) + ")"); + return (((("ConstructorsWithBuilderDefaults(x=" + this.getX()) + ", y=") + this.getY()) + ")"); } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults() { super(); + this.y = 0; this.x = ConstructorsWithBuilderDefaults.$default$x(); } - public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults(final int x) { + public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults(final int x, final int y) { super(); this.x = x; + this.y = y; } } diff --git a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java index 6094e2f4..cc96c674 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java @@ -1,60 +1,102 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.Builder; -final @Builder @Value class ConstructorsWithBuilderDefaults { - public static @java.lang.SuppressWarnings("all") class ConstructorsWithBuilderDefaultsBuilder { - private @java.lang.SuppressWarnings("all") int x; +final @Builder @Value class ConstructorsWithBuilderDefaults<T> { + public static @java.lang.SuppressWarnings("all") class ConstructorsWithBuilderDefaultsBuilder<T> { + private @java.lang.SuppressWarnings("all") java.util.List<T> z; + private @java.lang.SuppressWarnings("all") boolean z$set; + private @java.lang.SuppressWarnings("all") T x; private @java.lang.SuppressWarnings("all") boolean x$set; + private @java.lang.SuppressWarnings("all") T q; @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { super(); } - public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder x(final int x) { + public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder<T> z(final java.util.List<T> z) { + this.z = z; + z$set = true; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder<T> x(final T x) { this.x = x; x$set = true; return this; } - public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults build() { - return new ConstructorsWithBuilderDefaults((x$set ? x : ConstructorsWithBuilderDefaults.$default$x())); + public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder<T> q(final T q) { + this.q = q; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults<T> build() { + return new ConstructorsWithBuilderDefaults<T>((z$set ? z : ConstructorsWithBuilderDefaults.<T>$default$z()), (x$set ? x : ConstructorsWithBuilderDefaults.<T>$default$x()), q); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x) + ")"); + return (((((("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(z=" + this.z) + ", x=") + this.x) + ", q=") + this.q) + ")"); } } - private final @Builder.Default int x; - private static @java.lang.SuppressWarnings("all") int $default$x() { - return 5; + private final @Builder.Default java.util.List<T> z; + private final @Builder.Default T x; + private final T q; + private static @java.lang.SuppressWarnings("all") <T>java.util.List<T> $default$z() { + return new java.util.ArrayList<T>(); + } + private static @java.lang.SuppressWarnings("all") <T>T $default$x() { + return null; } - @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults(final int x) { + @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults(final java.util.List<T> z, final T x, final T q) { super(); + this.z = z; this.x = x; + this.q = q; } - public static @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder builder() { - return new ConstructorsWithBuilderDefaultsBuilder(); + public static @java.lang.SuppressWarnings("all") <T>ConstructorsWithBuilderDefaultsBuilder<T> builder() { + return new ConstructorsWithBuilderDefaultsBuilder<T>(); } - public @java.lang.SuppressWarnings("all") int getX() { + public @java.lang.SuppressWarnings("all") java.util.List<T> getZ() { + return this.z; + } + public @java.lang.SuppressWarnings("all") T getX() { return this.x; } + public @java.lang.SuppressWarnings("all") T getQ() { + return this.q; + } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) return true; if ((! (o instanceof ConstructorsWithBuilderDefaults))) return false; - final ConstructorsWithBuilderDefaults other = (ConstructorsWithBuilderDefaults) o; - if ((this.getX() != other.getX())) + final ConstructorsWithBuilderDefaults<?> other = (ConstructorsWithBuilderDefaults<?>) o; + final java.lang.Object this$z = this.getZ(); + final java.lang.Object other$z = other.getZ(); + if (((this$z == null) ? (other$z != null) : (! this$z.equals(other$z)))) + return false; + final java.lang.Object this$x = this.getX(); + final java.lang.Object other$x = other.getX(); + if (((this$x == null) ? (other$x != null) : (! this$x.equals(other$x)))) + return false; + final java.lang.Object this$q = this.getQ(); + final java.lang.Object other$q = other.getQ(); + if (((this$q == null) ? (other$q != null) : (! this$q.equals(other$q)))) return false; return true; } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { final int PRIME = 59; int result = 1; - result = ((result * PRIME) + this.getX()); + final java.lang.Object $z = this.getZ(); + result = ((result * PRIME) + (($z == null) ? 43 : $z.hashCode())); + final java.lang.Object $x = this.getX(); + result = ((result * PRIME) + (($x == null) ? 43 : $x.hashCode())); + final java.lang.Object $q = this.getQ(); + result = ((result * PRIME) + (($q == null) ? 43 : $q.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ConstructorsWithBuilderDefaults(x=" + this.getX()) + ")"); + return (((((("ConstructorsWithBuilderDefaults(z=" + this.getZ()) + ", x=") + this.getX()) + ", q=") + this.getQ()) + ")"); } private @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults() { super(); + this.q = null; + this.z = ConstructorsWithBuilderDefaults.$default$z(); this.x = ConstructorsWithBuilderDefaults.$default$x(); } -}
\ No newline at end of file +} diff --git a/test/transform/resource/before/ConstructorsWithBuilderDefaults.java b/test/transform/resource/before/ConstructorsWithBuilderDefaults.java index 5dd2940b..683cffe5 100644 --- a/test/transform/resource/before/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/before/ConstructorsWithBuilderDefaults.java @@ -3,6 +3,7 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.Builder; -@NoArgsConstructor @AllArgsConstructor @Builder @Value class ConstructorsWithBuilderDefaults { +@NoArgsConstructor(force = true) @AllArgsConstructor @Builder @Value class ConstructorsWithBuilderDefaults { @Builder.Default int x = 5; + int y; } diff --git a/test/transform/resource/before/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/before/ConstructorsWithBuilderDefaults2.java index 38300390..38965371 100644 --- a/test/transform/resource/before/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/before/ConstructorsWithBuilderDefaults2.java @@ -3,6 +3,8 @@ import lombok.NoArgsConstructor; import lombok.Value; import lombok.Builder; -@Builder @Value class ConstructorsWithBuilderDefaults { - @Builder.Default int x = 5; +@Builder @Value class ConstructorsWithBuilderDefaults<T> { + @Builder.Default java.util.List<T> z = new java.util.ArrayList<T>(); + @Builder.Default T x = null; + T q; } |