From 3de5d0908a2bdf0af3ed3c06eaa4978d3bc778cf Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Thu, 30 Dec 2021 19:04:00 +0100 Subject: [PATCH] [fixes #3070] fix guava type name for SuperBuilder's toBuilder --- .../singulars/EclipseGuavaSingularizer.java | 2 +- .../singulars/JavacGuavaSingularizer.java | 2 +- .../SuperBuilderSingularToBuilderGuava.java | 252 ++++++++++++++++++ .../SuperBuilderSingularToBuilderGuava.java | 221 +++++++++++++++ .../SuperBuilderSingularToBuilderGuava.java | 19 ++ 5 files changed, 494 insertions(+), 2 deletions(-) create mode 100644 test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java create mode 100644 test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java create mode 100644 test/transform/resource/before/SuperBuilderSingularToBuilderGuava.java diff --git a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java index 9b464a25c8..59fccdabec 100755 --- a/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java +++ b/src/core/lombok/eclipse/handlers/singulars/EclipseGuavaSingularizer.java @@ -93,7 +93,7 @@ protected char[][] makeGuavaTypeName(String simpleName, boolean addBuilder) { } @Override protected char[][] getEmptyMakerReceiver(String targetFqn) { - return CGCC; + return makeGuavaTypeName(GuavaTypeMap.getGuavaTypeName(targetFqn), false); } @Override public List generateFields(SingularData data, EclipseNode builderType) { diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java index ce5aad5e49..808b794a5a 100644 --- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java +++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java @@ -52,7 +52,7 @@ protected String getSimpleTargetTypeName(SingularData data) { } @Override protected String getEmptyMaker(String target) { - return target + ".of"; + return "com.google.common.collect." + GuavaTypeMap.getGuavaTypeName(target) + ".of"; } protected String getBuilderMethodName(SingularData data) { diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java b/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java new file mode 100644 index 0000000000..ec716fdd18 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java @@ -0,0 +1,252 @@ +public class SuperBuilderSingularToBuilderGuava { + public static class Parent { + private com.google.common.collect.ImmutableList cards; + private com.google.common.collect.ImmutableCollection frogs; + @SuppressWarnings("all") + private com.google.common.collect.ImmutableSet rawSet; + private com.google.common.collect.ImmutableSortedSet passes; + private com.google.common.collect.ImmutableTable users; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder, B extends SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder> { + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder cards; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder frogs; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSet.Builder rawSet; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSortedSet.Builder passes; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableTable.Builder users; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Parent instance, final SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder b) { + b.cards(instance.cards == null ? com.google.common.collect.ImmutableList.of() : instance.cards); + b.frogs(instance.frogs == null ? com.google.common.collect.ImmutableList.of() : instance.frogs); + b.rawSet(instance.rawSet == null ? com.google.common.collect.ImmutableSet.of() : instance.rawSet); + b.passes(instance.passes == null ? com.google.common.collect.ImmutableSortedSet.of() : instance.passes); + b.users(instance.users == null ? com.google.common.collect.ImmutableTable.of() : instance.users); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.SuppressWarnings("all") + public B card(final T card) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return self(); + } + @java.lang.SuppressWarnings("all") + public B cards(final java.lang.Iterable cards) { + if (cards == null) { + throw new java.lang.NullPointerException("cards cannot be null"); + } + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearCards() { + this.cards = null; + return self(); + } + @java.lang.SuppressWarnings("all") + public B frog(final Number frog) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return self(); + } + @java.lang.SuppressWarnings("all") + public B frogs(final java.lang.Iterable frogs) { + if (frogs == null) { + throw new java.lang.NullPointerException("frogs cannot be null"); + } + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearFrogs() { + this.frogs = null; + return self(); + } + @java.lang.SuppressWarnings("all") + public B rawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return self(); + } + @java.lang.SuppressWarnings("all") + public B rawSet(final java.lang.Iterable rawSet) { + if (rawSet == null) { + throw new java.lang.NullPointerException("rawSet cannot be null"); + } + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearRawSet() { + this.rawSet = null; + return self(); + } + @java.lang.SuppressWarnings("all") + public B pass(final String pass) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return self(); + } + @java.lang.SuppressWarnings("all") + public B passes(final java.lang.Iterable passes) { + if (passes == null) { + throw new java.lang.NullPointerException("passes cannot be null"); + } + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearPasses() { + this.passes = null; + return self(); + } + @java.lang.SuppressWarnings("all") + public B user(final Number rowKey, final Number columnKey, final String value) { + if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.put(rowKey, columnKey, value); + return self(); + } + @java.lang.SuppressWarnings("all") + public B users(final com.google.common.collect.Table users) { + if (users == null) { + throw new java.lang.NullPointerException("users cannot be null"); + } + if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.putAll(users); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearUsers() { + this.users = null; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ", users=" + this.users + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder, SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderSingularToBuilderGuava.Parent build() { + return new SuperBuilderSingularToBuilderGuava.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder b) { + com.google.common.collect.ImmutableList cards = b.cards == null ? com.google.common.collect.ImmutableList.of() : b.cards.build(); + this.cards = cards; + com.google.common.collect.ImmutableCollection frogs = b.frogs == null ? com.google.common.collect.ImmutableList.of() : b.frogs.build(); + this.frogs = frogs; + com.google.common.collect.ImmutableSet rawSet = b.rawSet == null ? com.google.common.collect.ImmutableSet.of() : b.rawSet.build(); + this.rawSet = rawSet; + com.google.common.collect.ImmutableSortedSet passes = b.passes == null ? com.google.common.collect.ImmutableSortedSet.of() : b.passes.build(); + this.passes = passes; + com.google.common.collect.ImmutableTable users = b.users == null ? com.google.common.collect.ImmutableTable.of() : b.users.build(); + this.users = users; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder builder() { + return new SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder toBuilder() { + return new SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static class Child extends Parent { + private double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder, B extends SuperBuilderSingularToBuilderGuava.Child.ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderSingularToBuilderGuava.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Child instance, final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder b) { + b.field3(instance.field3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderSingularToBuilderGuava.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderSingularToBuilderGuava.Child.ChildBuilder, SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderSingularToBuilderGuava.Child build() { + return new SuperBuilderSingularToBuilderGuava.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderSingularToBuilderGuava.Child.ChildBuilder builder() { + return new SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderSingularToBuilderGuava.Child.ChildBuilder toBuilder() { + return new SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + Child x = Child.builder().card(1).build().toBuilder().build(); + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java b/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java new file mode 100644 index 0000000000..76a8078199 --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java @@ -0,0 +1,221 @@ +public class SuperBuilderSingularToBuilderGuava { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder> { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder cards; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder frogs; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder rawSet; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedSet.Builder passes; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableTable.Builder users; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Parent instance, final SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder b) { + b.cards(((instance.cards == null) ? com.google.common.collect.ImmutableList.of() : instance.cards)); + b.frogs(((instance.frogs == null) ? com.google.common.collect.ImmutableList.of() : instance.frogs)); + b.rawSet(((instance.rawSet == null) ? com.google.common.collect.ImmutableSet.of() : instance.rawSet)); + b.passes(((instance.passes == null) ? com.google.common.collect.ImmutableSortedSet.of() : instance.passes)); + b.users(((instance.users == null) ? com.google.common.collect.ImmutableTable.of() : instance.users)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.SuppressWarnings("all") B card(final T card) { + if ((this.cards == null)) + this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return self(); + } + public @java.lang.SuppressWarnings("all") B cards(final java.lang.Iterable cards) { + if ((cards == null)) + { + throw new java.lang.NullPointerException("cards cannot be null"); + } + if ((this.cards == null)) + this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearCards() { + this.cards = null; + return self(); + } + public @java.lang.SuppressWarnings("all") B frog(final Number frog) { + if ((this.frogs == null)) + this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return self(); + } + public @java.lang.SuppressWarnings("all") B frogs(final java.lang.Iterable frogs) { + if ((frogs == null)) + { + throw new java.lang.NullPointerException("frogs cannot be null"); + } + if ((this.frogs == null)) + this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearFrogs() { + this.frogs = null; + return self(); + } + public @java.lang.SuppressWarnings("all") B rawSet(final java.lang.Object rawSet) { + if ((this.rawSet == null)) + this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return self(); + } + public @java.lang.SuppressWarnings("all") B rawSet(final java.lang.Iterable rawSet) { + if ((rawSet == null)) + { + throw new java.lang.NullPointerException("rawSet cannot be null"); + } + if ((this.rawSet == null)) + this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearRawSet() { + this.rawSet = null; + return self(); + } + public @java.lang.SuppressWarnings("all") B pass(final String pass) { + if ((this.passes == null)) + this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return self(); + } + public @java.lang.SuppressWarnings("all") B passes(final java.lang.Iterable passes) { + if ((passes == null)) + { + throw new java.lang.NullPointerException("passes cannot be null"); + } + if ((this.passes == null)) + this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearPasses() { + this.passes = null; + return self(); + } + public @java.lang.SuppressWarnings("all") B user(final Number rowKey, final Number columnKey, final String value) { + if ((this.users == null)) + this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.put(rowKey, columnKey, value); + return self(); + } + public @java.lang.SuppressWarnings("all") B users(final com.google.common.collect.Table users) { + if ((users == null)) + { + throw new java.lang.NullPointerException("users cannot be null"); + } + if ((this.users == null)) + this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.putAll(users); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearUsers() { + this.users = null; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((("SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ", users=") + this.users) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder, SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Parent build() { + return new SuperBuilderSingularToBuilderGuava.Parent(this); + } + } + private @lombok.Singular com.google.common.collect.ImmutableList cards; + private @lombok.Singular com.google.common.collect.ImmutableCollection frogs; + private @SuppressWarnings("all") @lombok.Singular("rawSet") com.google.common.collect.ImmutableSet rawSet; + private @lombok.Singular com.google.common.collect.ImmutableSortedSet passes; + private @lombok.Singular com.google.common.collect.ImmutableTable users; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder b) { + super(); + com.google.common.collect.ImmutableList cards = ((b.cards == null) ? com.google.common.collect.ImmutableList.of() : b.cards.build()); + this.cards = cards; + com.google.common.collect.ImmutableCollection frogs = ((b.frogs == null) ? com.google.common.collect.ImmutableList.of() : b.frogs.build()); + this.frogs = frogs; + com.google.common.collect.ImmutableSet rawSet = ((b.rawSet == null) ? com.google.common.collect.ImmutableSet.of() : b.rawSet.build()); + this.rawSet = rawSet; + com.google.common.collect.ImmutableSortedSet passes = ((b.passes == null) ? com.google.common.collect.ImmutableSortedSet.of() : b.passes.build()); + this.passes = passes; + com.google.common.collect.ImmutableTable users = ((b.users == null) ? com.google.common.collect.ImmutableTable.of() : b.users.build()); + this.users = users; + } + public @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder toBuilder() { + return new SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder builder() { + return new SuperBuilderSingularToBuilderGuava.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderSingularToBuilderGuava.Child.ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderSingularToBuilderGuava.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Child instance, final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder b) { + b.field3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderSingularToBuilderGuava.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderSingularToBuilderGuava.Child.ChildBuilder, SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Child build() { + return new SuperBuilderSingularToBuilderGuava.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Child.ChildBuilder toBuilder() { + return new SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderSingularToBuilderGuava.Child.ChildBuilder builder() { + return new SuperBuilderSingularToBuilderGuava.Child.ChildBuilderImpl(); + } + } + public SuperBuilderSingularToBuilderGuava() { + super(); + } + public static void test() { + Child x = Child.builder().card(1).build().toBuilder().build(); + } +} \ No newline at end of file diff --git a/test/transform/resource/before/SuperBuilderSingularToBuilderGuava.java b/test/transform/resource/before/SuperBuilderSingularToBuilderGuava.java new file mode 100644 index 0000000000..7e5b51f2dd --- /dev/null +++ b/test/transform/resource/before/SuperBuilderSingularToBuilderGuava.java @@ -0,0 +1,19 @@ +public class SuperBuilderSingularToBuilderGuava { + @lombok.experimental.SuperBuilder(toBuilder=true) + public static class Parent { + @lombok.Singular private com.google.common.collect.ImmutableList cards; + @lombok.Singular private com.google.common.collect.ImmutableCollection frogs; + @SuppressWarnings("all") @lombok.Singular("rawSet") private com.google.common.collect.ImmutableSet rawSet; + @lombok.Singular private com.google.common.collect.ImmutableSortedSet passes; + @lombok.Singular private com.google.common.collect.ImmutableTable users; + } + + @lombok.experimental.SuperBuilder(toBuilder=true) + public static class Child extends Parent { + private double field3; + } + + public static void test() { + Child x = Child.builder().card(1).build().toBuilder().build(); + } +}