diff options
Diffstat (limited to 'test/transform')
4 files changed, 191 insertions, 15 deletions
diff --git a/test/transform/knownBroken/before/I1298BuilderWithGenerics.java b/test/transform/knownBroken/before/I1298BuilderWithGenerics.java deleted file mode 100644 index af154d42..00000000 --- a/test/transform/knownBroken/before/I1298BuilderWithGenerics.java +++ /dev/null @@ -1,15 +0,0 @@ -import java.util.Set; -import lombok.Builder; -import lombok.Value; - -public class I1298BuilderWithGenerics { - interface Inter<T, U extends Inter<T, U>> {} - - @Builder @Value public static class Test< - Foo, - Bar extends Set<Foo>, - Quz extends Inter<Bar, Quz>> { - Foo foo; - Bar bar; - } -} diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java new file mode 100644 index 00000000..edc1e3c6 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java @@ -0,0 +1,100 @@ +import java.util.Set; +public class BuilderWithRecursiveGenerics { + interface Inter<T, U extends Inter<T, U>> { + } + public static final class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + private final Foo foo; + private final Bar bar; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + Test(final Foo foo, final Bar bar) { + this.foo = foo; + this.bar = bar; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static class TestBuilder<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private Foo foo; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + private Bar bar; + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + TestBuilder() { + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public TestBuilder<Foo, Bar, Quz> foo(final Foo foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public TestBuilder<Foo, Bar, Quz> bar(final Bar bar) { + this.bar = bar; + return this; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public Test<Foo, Bar, Quz> build() { + return new Test<Foo, Bar, Quz>(foo, bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public java.lang.String toString() { + return "BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo + ", bar=" + this.bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public static <Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> TestBuilder<Foo, Bar, Quz> builder() { + return new TestBuilder<Foo, Bar, Quz>(); + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public Foo getFoo() { + return this.foo; + } + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public Bar getBar() { + return this.bar; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderWithRecursiveGenerics.Test)) return false; + final BuilderWithRecursiveGenerics.Test<?, ?, ?> other = (BuilderWithRecursiveGenerics.Test<?, ?, ?>) o; + final java.lang.Object this$foo = this.getFoo(); + final java.lang.Object other$foo = other.getFoo(); + if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false; + final java.lang.Object this$bar = this.getBar(); + final java.lang.Object other$bar = other.getBar(); + if (this$bar == null ? other$bar != null : !this$bar.equals(other$bar)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.getFoo(); + result = result * PRIME + ($foo == null ? 43 : $foo.hashCode()); + final java.lang.Object $bar = this.getBar(); + result = result * PRIME + ($bar == null ? 43 : $bar.hashCode()); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + @javax.annotation.Generated("lombok") + public java.lang.String toString() { + return "BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo() + ", bar=" + this.getBar() + ")"; + } + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java new file mode 100644 index 00000000..f13b8b9b --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java @@ -0,0 +1,78 @@ +import java.util.Set; +import lombok.Builder; +import lombok.Value; +public class BuilderWithRecursiveGenerics { + interface Inter<T, U extends Inter<T, U>> { + } + public static final @Builder @Value class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") class TestBuilder<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Foo foo; + private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Bar bar; + @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") TestBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") TestBuilder<Foo, Bar, Quz> foo(final Foo foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") TestBuilder<Foo, Bar, Quz> bar(final Bar bar) { + this.bar = bar; + return this; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Test<Foo, Bar, Quz> build() { + return new Test<Foo, Bar, Quz>(foo, bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { + return (((("BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo) + ", bar=") + this.bar) + ")"); + } + } + private final Foo foo; + private final Bar bar; + @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Test(final Foo foo, final Bar bar) { + super(); + this.foo = foo; + this.bar = bar; + } + public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") <Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>>TestBuilder<Foo, Bar, Quz> builder() { + return new TestBuilder<Foo, Bar, Quz>(); + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Foo getFoo() { + return this.foo; + } + public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") Bar getBar() { + return this.bar; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderWithRecursiveGenerics.Test))) + return false; + final BuilderWithRecursiveGenerics.Test<?, ?, ?> other = (BuilderWithRecursiveGenerics.Test<?, ?, ?>) o; + final java.lang.Object this$foo = this.getFoo(); + final java.lang.Object other$foo = other.getFoo(); + if (((this$foo == null) ? (other$foo != null) : (! this$foo.equals(other$foo)))) + return false; + final java.lang.Object this$bar = this.getBar(); + final java.lang.Object other$bar = other.getBar(); + if (((this$bar == null) ? (other$bar != null) : (! this$bar.equals(other$bar)))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.getFoo(); + result = ((result * PRIME) + (($foo == null) ? 43 : $foo.hashCode())); + final java.lang.Object $bar = this.getBar(); + result = ((result * PRIME) + (($bar == null) ? 43 : $bar.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { + return (((("BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); + } + } + public BuilderWithRecursiveGenerics() { + super(); + } +} + diff --git a/test/transform/resource/before/BuilderWithRecursiveGenerics.java b/test/transform/resource/before/BuilderWithRecursiveGenerics.java new file mode 100644 index 00000000..041da414 --- /dev/null +++ b/test/transform/resource/before/BuilderWithRecursiveGenerics.java @@ -0,0 +1,13 @@ +//issue #1298 +import java.util.Set; +import lombok.Builder; +import lombok.Value; + +public class BuilderWithRecursiveGenerics { + interface Inter<T, U extends Inter<T, U>> {} + + @Builder @Value public static class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + Foo foo; + Bar bar; + } +} |