From 6045c1b8f524064a492b0dae9fbfbe89a1dca232 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 28 May 2018 21:54:12 +0200 Subject: Generate default no-args constructor --- .../resource/after-delombok/BuilderDefaults.java | 6 ++ .../BuilderWithRecursiveGenerics.java | 5 ++ .../resource/after-delombok/DataConfiguration.java | 4 ++ .../resource/after-delombok/DataIgnore.java | 4 ++ .../resource/after-delombok/DataOnLocalClass.java | 11 ++++ .../resource/after-delombok/DataPlain.java | 12 ++++ .../resource/after-delombok/DataWithGetter.java | 4 ++ .../after-delombok/DataWithGetterNone.java | 4 ++ .../resource/after-delombok/InnerClass.java | 4 ++ .../after-delombok/NoPrivateNoArgsConstructor.java | 73 ++++++++++++++++++++++ .../resource/after-delombok/ValuePlain.java | 14 +++++ .../resource/after-ecj/BuilderDefaults.java | 6 ++ .../after-ecj/BuilderWithRecursiveGenerics.java | 5 ++ .../resource/after-ecj/DataConfiguration.java | 4 ++ test/transform/resource/after-ecj/DataIgnore.java | 4 ++ .../resource/after-ecj/DataOnLocalClass.java | 11 ++++ test/transform/resource/after-ecj/DataPlain.java | 12 ++++ .../resource/after-ecj/DataWithGetter.java | 4 ++ .../resource/after-ecj/DataWithGetterNone.java | 4 ++ test/transform/resource/after-ecj/InnerClass.java | 4 ++ .../after-ecj/NoPrivateNoArgsConstructor.java | 68 ++++++++++++++++++++ test/transform/resource/after-ecj/ValuePlain.java | 14 +++++ .../before/NoPrivateNoArgsConstructor.java | 12 ++++ 23 files changed, 289 insertions(+) create mode 100644 test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java create mode 100644 test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java create mode 100644 test/transform/resource/before/NoPrivateNoArgsConstructor.java (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/BuilderDefaults.java b/test/transform/resource/after-delombok/BuilderDefaults.java index b916b725..e92197ad 100644 --- a/test/transform/resource/after-delombok/BuilderDefaults.java +++ b/test/transform/resource/after-delombok/BuilderDefaults.java @@ -67,6 +67,12 @@ public final class BuilderDefaults { return new BuilderDefaultsBuilder(); } @java.lang.SuppressWarnings("all") + private BuilderDefaults() { + this.x = 0; + this.name = null; + this.z = 0L; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java index 7fb300e4..91674ea9 100644 --- a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java @@ -44,6 +44,11 @@ public class BuilderWithRecursiveGenerics { return new TestBuilder(); } @java.lang.SuppressWarnings("all") + private Test() { + this.foo = null; + this.bar = null; + } + @java.lang.SuppressWarnings("all") public Foo getFoo() { return this.foo; } diff --git a/test/transform/resource/after-delombok/DataConfiguration.java b/test/transform/resource/after-delombok/DataConfiguration.java index b71e1c81..6771a6a7 100644 --- a/test/transform/resource/after-delombok/DataConfiguration.java +++ b/test/transform/resource/after-delombok/DataConfiguration.java @@ -5,6 +5,10 @@ class DataConfiguration { this.x = x; } @java.lang.SuppressWarnings("all") + private DataConfiguration() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataIgnore.java b/test/transform/resource/after-delombok/DataIgnore.java index 309d8150..02a0107f 100644 --- a/test/transform/resource/after-delombok/DataIgnore.java +++ b/test/transform/resource/after-delombok/DataIgnore.java @@ -6,6 +6,10 @@ class DataIgnore { this.x = x; } @java.lang.SuppressWarnings("all") + private DataIgnore() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java index 84817897..c178f1f3 100644 --- a/test/transform/resource/after-delombok/DataOnLocalClass.java +++ b/test/transform/resource/after-delombok/DataOnLocalClass.java @@ -8,6 +8,10 @@ class DataOnLocalClass1 { this.x = x; } @java.lang.SuppressWarnings("all") + private Local() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -68,6 +72,9 @@ class DataOnLocalClass2 { } this.name = name; } + @java.lang.SuppressWarnings("all") + private InnerLocal() { + } @lombok.NonNull @java.lang.SuppressWarnings("all") public String getName() { @@ -116,6 +123,10 @@ class DataOnLocalClass2 { this.x = x; } @java.lang.SuppressWarnings("all") + private Local() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index d54baef1..7b3d8f11 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -6,6 +6,10 @@ class Data1 { this.x = x; } @java.lang.SuppressWarnings("all") + private Data1() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -58,6 +62,10 @@ class Data2 { this.x = x; } @java.lang.SuppressWarnings("all") + private Data2() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -110,6 +118,10 @@ final class Data3 { this.x = x; } @java.lang.SuppressWarnings("all") + private Data3() { + this.x = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-delombok/DataWithGetter.java b/test/transform/resource/after-delombok/DataWithGetter.java index b4107bb3..6d3036f4 100644 --- a/test/transform/resource/after-delombok/DataWithGetter.java +++ b/test/transform/resource/after-delombok/DataWithGetter.java @@ -7,6 +7,10 @@ class DataWithGetter { this.z = z; } @java.lang.SuppressWarnings("all") + private DataWithGetter() { + this.z = null; + } + @java.lang.SuppressWarnings("all") public void setX(final int x) { this.x = x; } diff --git a/test/transform/resource/after-delombok/DataWithGetterNone.java b/test/transform/resource/after-delombok/DataWithGetterNone.java index 4467e407..692ee9a0 100644 --- a/test/transform/resource/after-delombok/DataWithGetterNone.java +++ b/test/transform/resource/after-delombok/DataWithGetterNone.java @@ -7,6 +7,10 @@ class DataWithGetterNone { this.z = z; } @java.lang.SuppressWarnings("all") + private DataWithGetterNone() { + this.z = null; + } + @java.lang.SuppressWarnings("all") public void setX(final int x) { this.x = x; } diff --git a/test/transform/resource/after-delombok/InnerClass.java b/test/transform/resource/after-delombok/InnerClass.java index 2e49b9ad..8040d9ff 100644 --- a/test/transform/resource/after-delombok/InnerClass.java +++ b/test/transform/resource/after-delombok/InnerClass.java @@ -20,6 +20,10 @@ class C { this.a = a; } @java.lang.SuppressWarnings("all") + private D() { + this.a = null; + } + @java.lang.SuppressWarnings("all") public A getA() { return this.a; } diff --git a/test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java b/test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java new file mode 100644 index 00000000..b354a85d --- /dev/null +++ b/test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java @@ -0,0 +1,73 @@ +public class NoPrivateNoArgsConstructor { + public static class NoPrivateNoArgsConstructorData { + private final int i; + @java.lang.SuppressWarnings("all") + public NoPrivateNoArgsConstructorData(final int i) { + this.i = i; + } + @java.lang.SuppressWarnings("all") + public int getI() { + return this.i; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData)) return false; + final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.getI() != other.getI()) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getI(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData(i=" + this.getI() + ")"; + } + } + public static final class NoPrivateNoArgsConstructorValue { + private final int i; + @java.lang.SuppressWarnings("all") + public NoPrivateNoArgsConstructorValue(final int i) { + this.i = i; + } + @java.lang.SuppressWarnings("all") + public int getI() { + return this.i; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue)) return false; + final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue) o; + if (this.getI() != other.getI()) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getI(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue(i=" + this.getI() + ")"; + } + } +} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValuePlain.java b/test/transform/resource/after-delombok/ValuePlain.java index cf2c1142..0cbd8621 100644 --- a/test/transform/resource/after-delombok/ValuePlain.java +++ b/test/transform/resource/after-delombok/ValuePlain.java @@ -7,6 +7,11 @@ final class Value1 { this.name = name; } @java.lang.SuppressWarnings("all") + private Value1() { + this.x = 0; + this.name = null; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -51,6 +56,11 @@ class Value2 { this.name = name; } @java.lang.SuppressWarnings("all") + private Value2() { + this.x = 0; + this.name = null; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } @@ -100,6 +110,10 @@ final class Value3 { this.y = y; } @java.lang.SuppressWarnings("all") + private Value3() { + this.y = 0; + } + @java.lang.SuppressWarnings("all") public int getX() { return this.x; } diff --git a/test/transform/resource/after-ecj/BuilderDefaults.java b/test/transform/resource/after-ecj/BuilderDefaults.java index 1a0f1168..1b9cd0ac 100644 --- a/test/transform/resource/after-ecj/BuilderDefaults.java +++ b/test/transform/resource/after-ecj/BuilderDefaults.java @@ -87,4 +87,10 @@ public final @Value @Builder class BuilderDefaults { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("BuilderDefaults(x=" + this.getX()) + ", name=") + this.getName()) + ", z=") + this.getZ()) + ")"); } + private @java.lang.SuppressWarnings("all") BuilderDefaults() { + super(); + this.x = 0; + this.name = null; + this.z = 0L; + } } diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java index 8246ca2c..1db5a914 100644 --- a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java @@ -70,6 +70,11 @@ public class BuilderWithRecursiveGenerics { public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); } + private @java.lang.SuppressWarnings("all") Test() { + super(); + this.foo = null; + this.bar = null; + } } public BuilderWithRecursiveGenerics() { super(); diff --git a/test/transform/resource/after-ecj/DataConfiguration.java b/test/transform/resource/after-ecj/DataConfiguration.java index 1e7adfbf..25f7620e 100644 --- a/test/transform/resource/after-ecj/DataConfiguration.java +++ b/test/transform/resource/after-ecj/DataConfiguration.java @@ -31,4 +31,8 @@ super(); this.x = x; } + private @java.lang.SuppressWarnings("all") DataConfiguration() { + super(); + this.x = 0; + } } diff --git a/test/transform/resource/after-ecj/DataIgnore.java b/test/transform/resource/after-ecj/DataIgnore.java index d3ac8aa3..d0fd1b1b 100644 --- a/test/transform/resource/after-ecj/DataIgnore.java +++ b/test/transform/resource/after-ecj/DataIgnore.java @@ -32,4 +32,8 @@ super(); this.x = x; } + private @java.lang.SuppressWarnings("all") DataIgnore() { + super(); + this.x = 0; + } } diff --git a/test/transform/resource/after-ecj/DataOnLocalClass.java b/test/transform/resource/after-ecj/DataOnLocalClass.java index 341df49b..03f0caaf 100644 --- a/test/transform/resource/after-ecj/DataOnLocalClass.java +++ b/test/transform/resource/after-ecj/DataOnLocalClass.java @@ -50,6 +50,10 @@ class DataOnLocalClass1 { super(); this.x = x; } + private @java.lang.SuppressWarnings("all") Local() { + super(); + this.x = 0; + } } } } @@ -103,6 +107,9 @@ class DataOnLocalClass2 { } this.name = name; } + private @java.lang.SuppressWarnings("all") InnerLocal() { + super(); + } } final int x; public @java.lang.SuppressWarnings("all") int getX() { @@ -136,6 +143,10 @@ class DataOnLocalClass2 { super(); this.x = x; } + private @java.lang.SuppressWarnings("all") Local() { + super(); + this.x = 0; + } } } DataOnLocalClass2() { diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java index eaeef509..be46cd24 100644 --- a/test/transform/resource/after-ecj/DataPlain.java +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -45,6 +45,10 @@ import lombok.Data; super(); this.x = x; } + private @java.lang.SuppressWarnings("all") Data1() { + super(); + this.x = 0; + } } @Data class Data2 { final int x; @@ -92,6 +96,10 @@ import lombok.Data; super(); this.x = x; } + private @java.lang.SuppressWarnings("all") Data2() { + super(); + this.x = 0; + } } final @Data class Data3 { final int x; @@ -134,6 +142,10 @@ final @Data class Data3 { super(); this.x = x; } + private @java.lang.SuppressWarnings("all") Data3() { + super(); + this.x = 0; + } } final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java.util.Timer { int x; diff --git a/test/transform/resource/after-ecj/DataWithGetter.java b/test/transform/resource/after-ecj/DataWithGetter.java index fa291eca..0fec7684 100644 --- a/test/transform/resource/after-ecj/DataWithGetter.java +++ b/test/transform/resource/after-ecj/DataWithGetter.java @@ -45,6 +45,10 @@ super(); this.z = z; } + private @java.lang.SuppressWarnings("all") DataWithGetter() { + super(); + this.z = null; + } public @java.lang.SuppressWarnings("all") int getX() { return this.x; } diff --git a/test/transform/resource/after-ecj/DataWithGetterNone.java b/test/transform/resource/after-ecj/DataWithGetterNone.java index 4545dc46..fb4a7c2e 100644 --- a/test/transform/resource/after-ecj/DataWithGetterNone.java +++ b/test/transform/resource/after-ecj/DataWithGetterNone.java @@ -45,4 +45,8 @@ super(); this.z = z; } + private @java.lang.SuppressWarnings("all") DataWithGetterNone() { + super(); + this.z = null; + } } diff --git a/test/transform/resource/after-ecj/InnerClass.java b/test/transform/resource/after-ecj/InnerClass.java index 32004225..05c6dc94 100644 --- a/test/transform/resource/after-ecj/InnerClass.java +++ b/test/transform/resource/after-ecj/InnerClass.java @@ -49,6 +49,10 @@ class C { super(); this.a = a; } + private @java.lang.SuppressWarnings("all") D() { + super(); + this.a = null; + } } C() { super(); diff --git a/test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java b/test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java new file mode 100644 index 00000000..a2bfe3bd --- /dev/null +++ b/test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java @@ -0,0 +1,68 @@ +public class NoPrivateNoArgsConstructor { + public static @lombok.Data class NoPrivateNoArgsConstructorData { + private final int i; + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData))) + return false; + final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getI() != other.getI())) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.getI()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData(i=" + this.getI()) + ")"); + } + public @java.lang.SuppressWarnings("all") NoPrivateNoArgsConstructorData(final int i) { + super(); + this.i = i; + } + } + public static final @lombok.Value class NoPrivateNoArgsConstructorValue { + private final int i; + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue))) + return false; + final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue) o; + if ((this.getI() != other.getI())) + 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.getI()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue(i=" + this.getI()) + ")"); + } + public @java.lang.SuppressWarnings("all") NoPrivateNoArgsConstructorValue(final int i) { + super(); + this.i = i; + } + } + public NoPrivateNoArgsConstructor() { + super(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/ValuePlain.java b/test/transform/resource/after-ecj/ValuePlain.java index 442a63ac..0ff7369e 100644 --- a/test/transform/resource/after-ecj/ValuePlain.java +++ b/test/transform/resource/after-ecj/ValuePlain.java @@ -38,6 +38,11 @@ final @lombok.Value class Value1 { this.x = x; this.name = name; } + private @java.lang.SuppressWarnings("all") Value1() { + super(); + this.x = 0; + this.name = null; + } } @Value @lombok.experimental.NonFinal class Value2 { public final int x; @@ -83,6 +88,11 @@ final @lombok.Value class Value1 { this.x = x; this.name = name; } + private @java.lang.SuppressWarnings("all") Value2() { + super(); + this.x = 0; + this.name = null; + } } final @Value class Value3 { private @lombok.experimental.NonFinal int x; @@ -120,4 +130,8 @@ final @Value class Value3 { this.x = x; this.y = y; } + private @java.lang.SuppressWarnings("all") Value3() { + super(); + this.y = 0; + } } diff --git a/test/transform/resource/before/NoPrivateNoArgsConstructor.java b/test/transform/resource/before/NoPrivateNoArgsConstructor.java new file mode 100644 index 00000000..b7c2a616 --- /dev/null +++ b/test/transform/resource/before/NoPrivateNoArgsConstructor.java @@ -0,0 +1,12 @@ +//CONF: lombok.noArgsConstructor.extraPrivate = false +public class NoPrivateNoArgsConstructor { + @lombok.Data + public static class NoPrivateNoArgsConstructorData { + private final int i; + } + + @lombok.Value + public static class NoPrivateNoArgsConstructorValue { + int i; + } +} -- cgit