aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-09-10 22:24:06 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-09-10 22:24:48 +0200
commit6a42bccb9730b7072b1219a03642074ab96fbe61 (patch)
tree249e60a7ed8c70461d2c395ba463e3ee5b44e862
parent8c28302705a027646c0ee0a83379b4084cb475ba (diff)
downloadlombok-6a42bccb9730b7072b1219a03642074ab96fbe61.tar.gz
lombok-6a42bccb9730b7072b1219a03642074ab96fbe61.tar.bz2
lombok-6a42bccb9730b7072b1219a03642074ab96fbe61.zip
toBuilder() with singular should force the typeargs on the Collections.emptyList call.
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java1
-rw-r--r--test/transform/resource/after-ecj/BuilderWithToBuilder.java2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index 9a069c58..4d20f052 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -541,6 +541,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
MessageSend emptyList = new MessageSend();
emptyList.receiver = generateQualifiedNameRef(source, TypeConstants.JAVA, TypeConstants.UTIL, "Collections".toCharArray());
emptyList.selector = EMPTY_LIST;
+ emptyList.typeArguments = copyTypes(bfd.singularData.getTypeArgs().toArray(new TypeReference[0]));
ms.arguments = new Expression[] {new ConditionalExpression(ifNull, emptyList, tgt[1])};
}
ms.receiver = receiver;
diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java
index b9cc27dd..a8935107 100644
--- a/test/transform/resource/after-ecj/BuilderWithToBuilder.java
+++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java
@@ -74,7 +74,7 @@ import lombok.Builder;
return new BuilderWithToBuilderBuilder<T>();
}
public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> toBuilder() {
- return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(((this.bars == null) ? java.util.Collections.emptyList() : this.bars));
+ return new BuilderWithToBuilderBuilder<T>().one(this.mOne).two(this.mTwo).foo(BuilderWithToBuilder.rrr(this)).bars(((this.bars == null) ? java.util.Collections.<T>emptyList() : this.bars));
}
}
@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder<T> {