diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2020-11-25 09:25:57 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-12-03 23:40:44 +0100 |
commit | 965f2367e0e57744c51b10ac341400b8ec57287a (patch) | |
tree | 576aefcf9b19488d9499c785e056a72907471221 /test/transform | |
parent | e1f82ac4d132769cfc272dccfc916aeba7181718 (diff) | |
download | lombok-965f2367e0e57744c51b10ac341400b8ec57287a.tar.gz lombok-965f2367e0e57744c51b10ac341400b8ec57287a.tar.bz2 lombok-965f2367e0e57744c51b10ac341400b8ec57287a.zip |
[fixes #2657] Use the correct field to query parent type parameters
Diffstat (limited to 'test/transform')
3 files changed, 93 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilder.java b/test/transform/resource/after-delombok/BuilderWithToBuilder.java index d98d09f6..3eeadcc5 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilder.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilder.java @@ -147,4 +147,52 @@ class ConstructorWithToBuilder<T> { public ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> toBuilder() { return new ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T>().mOne(this.mOne).baz(this.foo).bars(this.bars); } +} +class StaticMethodWithToBuilder<T> { + private T foo; + + public StaticMethodWithToBuilder(T foo) { + this.foo = foo; + } + + public static <T> StaticMethodWithToBuilder<T> of(T foo) { + return new StaticMethodWithToBuilder<T>(foo); + } + + @java.lang.SuppressWarnings("all") + public static class StaticMethodWithToBuilderBuilder<T> { + @java.lang.SuppressWarnings("all") + private T foo; + + @java.lang.SuppressWarnings("all") + StaticMethodWithToBuilderBuilder() { + } + + @java.lang.SuppressWarnings("all") + public StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> foo(final T foo) { + this.foo = foo; + return this; + } + + @java.lang.SuppressWarnings("all") + public StaticMethodWithToBuilder<T> build() { + return StaticMethodWithToBuilder.<T>of(this.foo); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder(foo=" + this.foo + ")"; + } + } + + @java.lang.SuppressWarnings("all") + public static <T> StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> builder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>(); + } + + @java.lang.SuppressWarnings("all") + public StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> toBuilder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>().foo(this.foo); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java index 72fa3721..857caa17 100644 --- a/test/transform/resource/after-ecj/BuilderWithToBuilder.java +++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java @@ -126,3 +126,35 @@ import lombok.Builder; return new ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T>().mOne(this.mOne).baz(this.foo).bars(this.bars); } } +class StaticMethodWithToBuilder<T> { + public static @java.lang.SuppressWarnings("all") class StaticMethodWithToBuilderBuilder<T> { + private @java.lang.SuppressWarnings("all") T foo; + @java.lang.SuppressWarnings("all") StaticMethodWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> foo(final T foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") StaticMethodWithToBuilder<T> build() { + return StaticMethodWithToBuilder.<T>of(this.foo); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder(foo=" + this.foo) + ")"); + } + } + private T foo; + public StaticMethodWithToBuilder(T foo) { + super(); + this.foo = foo; + } + public static @Builder(toBuilder = true) <T>StaticMethodWithToBuilder<T> of(T foo) { + return new StaticMethodWithToBuilder<T>(foo); + } + public static @java.lang.SuppressWarnings("all") <T>StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> builder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> toBuilder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>().foo(this.foo); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/BuilderWithToBuilder.java b/test/transform/resource/before/BuilderWithToBuilder.java index 50938ab2..5b87a18f 100644 --- a/test/transform/resource/before/BuilderWithToBuilder.java +++ b/test/transform/resource/before/BuilderWithToBuilder.java @@ -18,3 +18,16 @@ class ConstructorWithToBuilder<T> { public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) { } } + +class StaticMethodWithToBuilder<T> { + private T foo; + + public StaticMethodWithToBuilder(T foo) { + this.foo = foo; + } + + @Builder(toBuilder = true) + public static <T> StaticMethodWithToBuilder<T> of(T foo) { + return new StaticMethodWithToBuilder<T>(foo); + } +}
\ No newline at end of file |